On Wed, Mar 19, 2008 at 9:40 AM, Charlie Griefer
<[EMAIL PROTECTED]> wrote:
> On Wed, Mar 19, 2008 at 9:33 AM, Sonny Savage <[EMAIL PROTECTED]> wrote:
>  > Hello,  I apologize if this is a dumb question, but I'm a bit a n00b when 
> it
>  >  comes to XML in CF.
>  >
>  >  I have XML that looks something like this:
>  >  <testElements>
>  >   <testElement>text 1</testElement>
>  >   <testElement>text 2</testElement>
>  >  </testElements>
>  >
>  >  What I want to know is how I get the values from both sub-nodes, even 
> though
>  >  they have the same name.
>
>  <cfsavecontent variable="myXML">
>
> <testElements>
>   <testElement>text 1</testElement>
>   <testElement>text 2</testElement>
>  </testElements>
>  </cfsavecontent>
>
>  <cfset parsedXML = xmlParse(myXML)>
>
>  <cfdump var="#parsedXML#">
>
>  <cfoutput>
>         Text 1: #parsedXML.testElements.testElement[1].XmlText#<br />
>         Text 2: #parsedXML.testElements.testElement[2].XmlText#<br />
>  </cfoutput>

you can also get a little more dynamic and loop over
testElements.testElement as an array:

<cfoutput>
        <cfloop from="1" to="#arrayLen(parsedXML.testElements.testElement)#"
index="idx">
                #parsedXML.testElements.testElement[idx].xmlText#<br />
        </cfloop>
</cfoutput>

-- 
Evelyn the dog, having undergone further modification pondered the
significance of short-person behaviour in pedal depressed,
pan-chromatic resonance, and other highly ambient domains. "Arf," she
said.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301586
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to