How to write/format xml nodes

admin

Administrator
Staff member
Hi all - ok i have got my code working and a response back. Its a fairly hefty string - in cut down version it looks like this:

<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <SOAP-ENV:Body>
- <barceloDS_responses ip="">
- <response>
- <request type="valued availability list" id="1">
<session_id>852466674</session_id>
<language_code>ING</language_code>
- <agency>
<primary>888</primary>
<secondary>88</secondary>
<detail>888</detail>
<branch>1</branch>
On-Line reservation interfaceVersion 1.0.8b April 2006
</agency>
<contract />
<check_in_date>20070407</check_in_date>
<check_out_date>20070408</check_out_date>
- <location>
<destination_code>PMI</destination_code>
<zone_code />
</location>
- <establishment>
<code />
<category />
</establishment>
<board_type_code />
- <occupancy>
<adults>2</adults>
<children>1</children>
<rooms>1</rooms>
</occupancy>
</request>
- <valued_list>
<valuation_file_number>12</valuation_file_number>
<total_pages>1</total_pages>
<current_page>1</current_page>
<total_hotels>7</total_hotels>
- <establishment>
<code>8290</code>
<description>THB Cala Lliteras</description>
<contract>3.3RDXML</contract>
<child_min_age>0</child_min_age>
<child_max_age>12</child_max_age>
- <location>
- <destination>
<code>PMI</code>
<description>Majorca</description>
</destination>
- <zone>
<code>87</code>
<description>Cala Ratjada</description>
</zone>
</location>
- <category>
<code>3EST</code>
<description>3 STARS</description>
</category>
<incoming_contract>TSG0027702</incoming_contract>
<offer>YES</offer>
<classification>NOR</classification>
<currency>EUR</currency>
- <room>
<code>DBL.SU</code>
<description>DOUBLE/ TWIN SUPERIOR</description>
<availability>998</availability>
- <price>
- <occupancy>
<adults>2</adults>
<children>1</children>
<rooms>1</rooms>
</occupancy>
- <board_type>
<code>HD</code>
<description>BED AND BREAKFAST</description>
</board_type>
<amount>106.41</amount>
</price>
</room>
- <room>
<code>TPL.SU</code>
<description>TRIPLE SUPERIOR</description>
<availability>998</availability>
- <price>
- <occupancy>
<adults>2</adults>
<children>1</children>
<rooms>1</rooms>
</occupancy>
- <board_type>
<code>HD</code>
<description>BED AND BREAKFAST</description>
</board_type>
<amount>133.28</amount>
</price>
</room>
</establishment>
</valued_list>
</response>
</barceloDS_responses>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

THe following code is displaying some of the above however i'm a bit lost as to how to dig out and break down further the info in the location node

Dim objXMLDom
Set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")

objXMLDOM.async = False
objXMLDom.loadXML(strReturn)

Dim objChild


Set objItemList = objXMLDom.getElementsByTagName("valued_list/establishment")

For Each objItem In objItemList
response.write("<b>Code:</b> " & objItem.childNodes(0).text & "<br>")
response.write("<b>Description:</b> " & objItem.childNodes(1).text & "<br>")
response.write("<b>Location:</b> " & objItem.childNodes(5).text & "<br>")
response.write("<hr>")
next

etc.......Any help or other ideas appreciated.........:)
 
Back
Top