Hi,
I have an xml document that for my purposes here can be shortened to:
I have been able to deserialize the nodes 'Report-Header' and 'Insurance-Details' fine with this code below for 'Report-Header':
Which is great. However, when using identicle code (except for the name and type of the object) when I deserialize an 'Energy-Performance-Certificate' or even an 'EPC-Rating' I get all zero values.
Does anyone have any ideas as to what might be going wrong??
Thanks for any help in advance.
Russ.
I have an xml document that for my purposes here can be shortened to:
HTML:
<?xml version="1.0" encoding="UTF-8"?>
<Report
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="DCLG-CEPC"
xsi:schemaLocation="DCLG-CEPC ..\Reports\CEPC-Reports.xsd"
>
<Report-Header>
<RRN>0455-3619-8688-5206-9225</RRN>
<Issue-Date>2008-01-28</Issue-Date>
<Report-Type>3</Report-Type>
<Valid-Until>2018-01-27</Valid-Until>
<Related-RRN>6946-8248-5680-5129-2506</Related-RRN>
<Inspection-Date>2008-01-21</Inspection-Date>
<Registration-Date>2008-01-28</Registration-Date>
<Status>entered</Status>
<Language-Code>1</Language-Code>
<Energy-Assessor>
<Certificate-Number>DFGT525256</Certificate-Number>
<Name>John Smith</Name>
<Accreditation-Scheme-Name>ABC Accreditation Ltd</Accreditation-Scheme-Name>
<Trading-Address>Alpha House, New Way, Birmingham, B2 1AA</Trading-Address>
<Company-Name>EnergyWatch Ltd</Company-Name>
<Related-Party-Disclosure> </Related-Party-Disclosure>
<Qualifications>NOS3</Qualifications>
<Status>Registered</Status>
</Energy-Assessor>
<Property-Details>
<Location-Description></Location-Description>
<UPRN>458622158656</UPRN>
<Property-Address>
<Address-Line-1>Example building</Address-Line-1>
<Address-Line-2>56 London Road</Address-Line-2>
<Post-Town>LONDON</Post-Town>
<Postcode>SW23 1HA</Postcode>
</Property-Address>
<Property-Type>OFFICE</Property-Type>
<Occupier>John Jones</Occupier>
<Is-Heritage-Site>N</Is-Heritage-Site>
</Property-Details>
<Calculation-Details>
<Methodology>iSBEM v3.0.a</Methodology>
<Calculation-Tool>SBEM v3.0.a_dev (JAN08)</Calculation-Tool>
<Inspection-Type>Physical</Inspection-Type>
</Calculation-Details>
</Report-Header>
<Insurance-Details>
<Insurer>My company for insurance</Insurer>
<Policy-No>0123456789</Policy-No>
<Effective-Date>2007-12-07</Effective-Date>
<Expiry-Date>2011-12-09</Expiry-Date>
<PI-Limit>500000</PI-Limit>
</Insurance-Details>
<Energy-Performance-Certificate>
<EPC-Rating>
<Asset-Rating>57</Asset-Rating>
<New-Build-Benchmark>57</New-Build-Benchmark>
<Existing-Stock-Benchmark>106</Existing-Stock-Benchmark>
</EPC-Rating>
<EPC-Rating-Scale>
<Upper-Number-A-Scale>24</Upper-Number-A-Scale>
<Lower-Number-B-Scale>25</Lower-Number-B-Scale>
<Upper-Number-B-Scale>50</Upper-Number-B-Scale>
<Lower-Number-C-Scale>51</Lower-Number-C-Scale>
<Upper-Number-C-Scale>77</Upper-Number-C-Scale>
<Lower-Number-D-Scale>78</Lower-Number-D-Scale>
<Upper-Number-D-Scale>106</Upper-Number-D-Scale>
<Lower-Number-E-Scale>107</Lower-Number-E-Scale>
<Upper-Number-E-Scale>136</Upper-Number-E-Scale>
<Lower-Number-F-Scale>137</Lower-Number-F-Scale>
<Upper-Number-F-Scale>167</Upper-Number-F-Scale>
<Lowest-Number-G-Scale>167</Lowest-Number-G-Scale>
</EPC-Rating-Scale>
<Technical-Information>
<Main-Heating-Fuel>Grid supplied electricity</Main-Heating-Fuel>
<Building-Environment>Air Conditioning</Building-Environment>
<Floor-Area>2900</Floor-Area>
<Building-Level>3</Building-Level>
</Technical-Information>
</Energy-Performance-Certificate>
</Report>
VB.NET:
' Returns a ReportHeader object filled values from the specified xml document
Public Function readReportHeader(ByVal filename As String) As CPEC_Reports.ComClass.ReportHeader
Dim d As New XmlDocument()
Dim s As New XmlSerializer(GetType(CPEC_Reports.ComClass.ReportHeader))
Dim nl As XmlNodeList
d.Load(filename)
nl = d.GetElementsByTagName("Report-Header")
Dim nr As New XmlNodeReader(nl(0))
Return s.Deserialize(nr)
End Function
Does anyone have any ideas as to what might be going wrong??
Thanks for any help in advance.
Russ.