Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / May 2006



Tip: Looking for answers? Try searching our database.

XML : How to extract children

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
xSist - 27 May 2006 06:37 GMT
The following is a call to amazon.com to return sub-categories - in this case
Baby > Activities.

<cfhttp url="<a target=_blank class=ftalternatingbarlinklarge
href="http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Subscri
ptionId=02C1DF8AE32GQ219EC02&AssociateTag=intellifit-20&Operation=BrowseNodeLook
up&BrowseNodeId=542460"">http://webservices.amazon.com/onca/xml?Service=AWSEComm
erceService&SubscriptionId=02C1DF8AE32GQ219EC02&AssociateTag=intellifit-20&Opera
tion=BrowseNodeLookup&BrowseNodeId=542460"</a> method="GET" resolveurl="yes"
throwonerror="yes">  
<cfset results = XmlParse(cfhttp.FileContent)>
<cfdump var="#results#">

Works properly and the <cfdump ...> return a well formed structure.
Here is where I get stuck : there are some of children that I need to extract
and I am no able to apply various examples of  "XmlSearch" or some <cfscript>s
in Macromedia - sorry - Adobe LiveDocs.

Please help a color-by-numbers newbie.

A nice Memorial Day weekEnd everybody.
ContiW
BKBK - 27 May 2006 17:43 GMT
Displaying these dumps in turn might lead you on to something:

<cfdump var="#results.xmlRoot.XmlChildren[1]#">
<cfdump var="#results.xmlRoot.XmlChildren[1].XmlChildren[1]#">
<cfdump var="#results.xmlRoot.XmlChildren[1].XmlChildren[1].XmlChildren[1]#">
xSist - 27 May 2006 18:00 GMT
Good hint. Thank you BKBK!
ContiW
xSist - 27 May 2006 18:49 GMT
DKDK

Following your advice I got
<cfloop from="1"
to="#arrayLen(results.xmlRoot.XmlChildren[2].XmlChildren[2].XmlChildren[3].XmlCh
ildren)#" index="i">
   <cfoutput>
   
#results.xmlRoot.XmlChildren[2].XmlChildren[2].XmlChildren[3].XmlChildren<i>.Xml
Children[2]#
   
#results.xmlRoot.XmlChildren[2].XmlChildren[2].XmlChildren[3].XmlChildren<i>.Xml
Children[1]#
   </cfoutput>
   <br>
</cfloop>

to give me exactly what I needed. Thank you.

Nevertheless, i would love to know how you have got the values for each level
of children.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.