Link to home
Start Free TrialLog in
Avatar of Nico2011
Nico2011Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Parse XML Sub Child Nodes

Hello,

I can access the first level nodes of an XML file I have, but don't know how to get to ones deeper in the file...  The code I have, which works so far is:

Set xmlDOM = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmlDOM.async = False
xmlDOM.setProperty "ServerHTTPRequest", True
xmlDOM.Load(Filename)
 
Set itemList = XMLDom.SelectNodes("hh/property")
 
For Each itemAttrib In itemList
i = i + 1
   PropRef =itemAttrib.SelectSingleNode("hh_reference").text
   town_name =itemAttrib.SelectSingleNode("town_name").text
   Region_Name =itemAttrib.SelectSingleNode("region_name").text
   
  %>
(<%=i%>)<%=PropRef%> - <%=Town_name%> - <%=Region_Name%><BR>
	<%
response.Flush()
Next
 
Set xmlDOM = Nothing
Set itemList = Nothing

Open in new window


However, here's a snippet of the XML file - need to get to the other nodes too, such as under Town there are further nodes as an example:

<property>
		<contact>
			<email>info@home-hunts.com </email>
			<phone>+33 (0) 870 44 66 43</phone>
		</contact>
		<hh_reference>HH-636</hh_reference>
		<town_name><![CDATA[CAP D AIL]]></town_name>
		<region_name><![CDATA[Riviera]]></region_name>
		<area_name><![CDATA[Villefranche, Cap Ferrat Area]]></area_name>
		<country_name><![CDATA[FRANCE]]></country_name>
		<style_name><![CDATA[-To confirm-]]></style_name>
		<rooms>0</rooms>
		<bedrooms>9</bedrooms>
		<bathrooms>0</bathrooms>
		<town>
			<zip></zip>
			<name><![CDATA[CAP D AIL]]></name>
			<country><![CDATA[FR]]></country>
			<area><![CDATA[paca]]></area>
			<extra><![CDATA[Villefranche, Cap Ferrat Area]]></extra>
		</town>

Open in new window


Thanks in advance for you help!
ASKER CERTIFIED SOLUTION
Avatar of zc2
zc2
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nico2011

ASKER

Beautiful - thanks very much :-)
You're welcome