Monday, 2 September 2013

How to retrieve XML - VB.Net

How to retrieve XML - VB.Net

I have never worked with XML before. I have tried a few code and read
forums, but I'm still a very new junior developer. How can I retrieve the
three elements in the three tables within this XML file? There apears to
be three tables, but sometimes there will be only one, sometimes none, and
sometimes more than one.Maybe a loop?
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ExactSearchResponse xmlns="http://www.sars.gov.za">
<ExactSearchResult>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:element
name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType><xs:choice minOccurs="0"
maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType><xs:sequence>
<xs:element name="VAT_x0020_REG_x0020_NO"
type="xs:long" minOccurs="0" />
<xs:element name="TRADING_x0020_NAME"
type="xs:string" minOccurs="0" />
<xs:element name="AREA_x0020_DESC"
type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element></xs:choice></xs:complexType></xs:element>
</xs:schema>
<diffgr:diffgram
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<VAT_x0020_REG_x0020_NO>number</VAT_x0020_REG_x0020_NO>
<TRADING_x0020_NAME>name</TRADING_x0020_NAME>
<AREA_x0020_DESC>area</AREA_x0020_DESC>
</Table>
<Table diffgr:id="Table2" msdata:rowOrder="1">
<VAT_x0020_REG_x0020_NO>number_2</VAT_x0020_REG_x0020_NO>
<TRADING_x0020_NAME>name_2</TRADING_x0020_NAME>
<AREA_x0020_DESC>area_2</AREA_x0020_DESC>
</Table>
<Table diffgr:id="Table3" msdata:rowOrder="1">
<VAT_x0020_REG_x0020_NO>number_3</VAT_x0020_REG_x0020_NO>
<TRADING_x0020_NAME>name_3</TRADING_x0020_NAME>
<AREA_x0020_DESC>area_3</AREA_x0020_DESC>
</Table>
</NewDataSet>
</diffgr:diffgram>
</ExactSearchResult>
</ExactSearchResponse>
</soap:Body>

No comments:

Post a Comment