Re: XML Parsing in CF Help

2006-05-10 Thread Michael Traher
loop through the array mydoc.nitf.head.meta testing mydoc.nitf.head.meta[i].XmlAttributes.name for the value you need. On 5/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: -- Mike T Blog http://www.socialpoints.com/ ~|

Re: XML Parsing in CF Help

2006-05-10 Thread Rob Wilkerson
Hey Jonathan - This worked perfectly for me. And, if you're really just looking for that one element it will be much faster than iterating across the entire document. The code below, as pointed out by Brad, returns a single element array. Code snippet below: cfoutput cfxml variable=xmldoc

XML Parsing in CF Help

2006-05-09 Thread jmauney
Hi, I'm working on parsing an xml document and have run into a brick wall. A portion of the xml is below... Here's the issue... I can sucessfully retrieve the ap-online-code using the following code: cfset mydoc = XmlParse(xmldoc) #mydoc.nitf.head.meta[8].XmlAttributes.content# (the above

RE: XML Parsing in CF Help

2006-05-09 Thread Ian Skinner
cfset mydoc = XmlParse(xmldoc) #mydoc.nitf.head.meta[8].XmlAttributes.content# (the above code outputs '1110' as expected) But I'm worried about the document changing. Can I somehow retrieve this by the name attribute (in this example 'ap-content-code') instead of position number? Assuming

Re: XML Parsing in CF Help

2006-05-09 Thread Rob Wilkerson
If you're looking specifically for that element, I'd use XPath/XMLSearch(). Try this: XMLSearch ( mydoc, '/nitf/head/[EMAIL PROTECTED]'ap-online-code']' ) On 5/9/06, Ian Skinner [EMAIL PROTECTED] wrote: cfset mydoc = XmlParse(xmldoc) #mydoc.nitf.head.meta[8].XmlAttributes.content# (the

Re: XML Parsing in CF Help

2006-05-09 Thread Jonathan Mauney
I tried that already... it doesn't work: Element ap-content-code is undefined in a Java object of type class coldfusion.xml.XmlNodeList referenced as Assuming that ap-content-code is a child of the meta node, this should work. mydoc.nitf.head.meta['ap-content-code'].XmlAttributes.content

Re: XML Parsing in CF Help

2006-05-09 Thread Jonathan Mauney
This didn't work either (after changing outer single quotes to double): Complex object types cannot be converted to simple values. If you're looking specifically for that element, I'd use XPath/XMLSearch(). Try this: XMLSearch ( mydoc, '/nitf/head/[EMAIL PROTECTED]'ap-online-code']' ) On

RE: XML Parsing in CF Help

2006-05-09 Thread Brad Wood
] to get the first element returned and then you will have a struct to dig through... ~Brad -Original Message- From: Jonathan Mauney [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 09, 2006 4:00 PM To: CF-Talk Subject: Re: XML Parsing in CF Help This didn't work either (after changing outer

RE: XML Parsing in CF Help

2006-05-09 Thread Ian Skinner
I tried that already... it doesn't work: Element ap-content-code is undefined in a Java object of type class coldfusion.xml.XmlNodeList referenced as Can you give us a relevant snippet of the XML structure you are trying to read? -- Ian Skinner Web Programmer BloodSource