just curious... what is the error? On Wed, Jun 11, 2008 at 5:42 PM, Steven Ross <[EMAIL PROTECTED]> wrote:
> Have you tried this?arrayImport[i][4] = > selectedElements[i]["rm:image"][i].XmlText; > > > On Wed, Jun 11, 2008 at 4:10 PM, Derrick Peavy < > [EMAIL PROTECTED]> wrote: > >> Steven, thank you. I did go through the W3School article after you sent it >> as well as skimming the doc that Charlie sent. I actually use that site a >> lot. With your help, I solved the two small problems, but the problem with >> duplicate children still plagues me. >> >> At this point, i am back to my original question with perhaps a more >> direct approach--- Can someone provide an example of accessing the data >> within an XML file wherein a parent element has several exactly named >> children. I still have not found the answer within the documents or on >> line. >> >> I appreciate the documentation that folks are sending - but I also learn >> about, oh I don't know, maybe 1000X faster by seeing actual code. But, >> that's just me. >> >> >> *Example code, demonstrating my problem* >> >> <feed> >> <entry> >> <title>A sample XML Child of "entry element"</title> >> <link href="http://www.someplace.com"></link> >> <summary>Looks like greek to me. Looks like greek to me. Looks like greek >> to me. Looks like greek to me. Looks like greek to me. Looks like greek to >> me. Looks like greek to me. </summary> >> <rm:id>852</rm:Id> >> <rm:image>http://www.someplace.com/img/user/442/852/4551594.jpg >> </rm:image> >> <rm:image>http://www.someplace.com/img/user/442/852/4551594a.jpg >> </rm:image> >> <rm:image>http://www.someplace.com/img/user/442/852/4551594b.jpg >> </rm:image> >> <rm:image>http://www.someplace.com/img/user/442/852/4551594c.jpg >> </rm:image> >> <rm:image>http://www.someplace.com/img/user/442/852/4551594d.jpg >> </rm:image> >> </entry> >> </feed> >> >> >> *And parsing that type of structure into an array is no problem EXPECT >> where the image is concerned. The following example works except for the >> last array element [4]. If it worked, it would at least insert the first >> instance of the rm:image child element. But nothing seems to work.* >> >> <cfscript> >> selectedElements = XmlSearch(XmlParse(trim(cfhttp.fileContent)), >> "/feed/entry/"); >> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) >> arrayImport[i][1] = selectedElements[i].summary.XmlText; >> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) >> arrayImport[i][2] = selectedElements[i].link.XmlAttributes.href; >> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) >> arrayImport[i][3] = selectedElements[i]["rm:id"].XmlText; >> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) >> arrayImport[i][4] = selectedElements[i]["rm:image"].XmlText; >> </cfscript> >> >> >> *So, documents and tutorials are always useful and appreciated, but after >> 6 hours on this today, I think I would understand the problem and solution >> much, much faster if someone out there had an actual example to point to. >> Thanks!* >> >> _____________ >> Derrick Peavy >> 404-786-5036 >> Sales and Web Services >> CollegeClassifieds.com >> http://www.collegeclassifieds.com >> A Service of Universal Advertising, inc. >> ___________________________________ >> >> >> On Jun 11, 2008, at 1:32 PM, Steven Ross wrote: >> >> I also recommend using the w3c xpath tutorial >> when i forget syntax I always look there first... >> >> http://www.w3schools.com/XPath/default.asp >> >> On Wed, Jun 11, 2008 at 11:53 AM, Charlie Arehart <[EMAIL PROTECTED]> >> wrote: >> >>> Derrick, besides Steven's useful replies to you so far, since you said >>> you were green with CF/XML processing, I can't recommend highly enough that >>> you spend 30 minutes reading this wonderful guide: >>> >>> >>> Utilizing XML and XSLT in ColdFusion MX >>> >>> http://www.adobe.com/devnet/coldfusion/articles/xmlxslt.pdf >>> >>> >>> Sure, it's 6 years old, and written for CF 6, but it's a classic and all >>> the info still applies. Just the best intro to the whole subject I ever saw. >>> Lots of examples, no presumption of your knowing anything about XML, XSLT, >>> XPATH, yet by the end of it's 30 pages you'll understand it all well enough >>> to do nearly anything you'd need. And, yes, it explains all those CFML >>> variables, structures, and functions you need to understand in order to >>> process XML with CFML. >>> >>> >>> I honestly wouldn't propose to try to help someone with a question on the >>> subject without strongly urging them to read it first. It's that good, and >>> thorough, and does a better job explaining things than I ever could. :-) >>> >>> >>> /charlie >>> >>> >>> *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Derrick >>> Peavy >>> *Sent:* Tuesday, June 10, 2008 11:31 PM >>> *To:* discussion@acfug.org >>> *Subject:* [ACFUG Discuss] XML Import/parse help - 3 questions about >>> sample data >>> >>> >>> I've been working with various XML documents, importing them and then >>> putting select data into a database. I am having problems with new types of >>> files and cannot seem to find an answer (Google). Maybe I am not using the >>> right terms when searching. But I hope someone here can help. >>> >>> >>> For the most part, it's all straight forward. I have been using this kind >>> of code.... >>> >>> >>> >>> <cfscript> >>> >>> selectedElements = >>> XmlSearch(XmlParse(trim(cfhttp.fileContent)), "/feed/feed_item/"); >>> >>> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) >>> >>> arrayImportRentMktCom[i][1] = >>> selectedElements[i].summary.XmlText; >>> >>> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) >>> >>> arrayImportRentMktCom[i][2] = >>> selectedElements[i].link.XmlText; >>> >>> for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1) >>> >>> arrayImportRentMktCom[i][3] = >>> selectedElements[i].image.XmlText; >>> >>> </cfscript> >>> >>> >>> >>> However, I am pretty green with this type of data handling when it's not >>> a simple structure. The problem I am having is when I encounter feeds with >>> structures such as: >>> >>> >>> <feed> >>> >>> <feed_item> >>> >>> <item_id>1234</id> >>> >>> <link href="somelink.html"/> >>> >>> <summary>Summary of the item within the XML data >>> structure that is being read.</summary> >>> >>> <fn:image> >>> http://www.someurl.com/img/pretty_pic_01.jpg</fn:image> >>> >>> <fn:image> >>> http://www.someurl.com/img/pretty_pic_02.jpg</fn:image> >>> >>> <fn:image> >>> http://www.someurl.com/img/pretty_pic_03.jpg</fn:image> >>> >>> <fn:image> >>> http://www.someurl.com/img/pretty_pic_04.jpg</fn:image> >>> >>> </feed_item> >>> >>> >>> >>> 1. When viewing the remote XML file using --- >>> XmlParse(trim(cfhttp.fileContent)) --- I see that the link is a >>> structure with an href element. How do you grab that data? >>> >>> >>> 2. How do you deal with multiple child elements with the same name? >>> >>> >>> 3. How do you deal with a colon in the element name? >>> >>> >>> >>> _____________ >>> >>> Derrick Peavy >>> >>> Sales and Web Services >>> >>> CollegeClassifieds.com >>> >>> http://www.collegeclassifieds.com >>> >>> A Service of Universal Advertising, inc. >>> >>> ___________________________________ >>> >>> >>> ------------------------------------------------------------- >>> To unsubscribe from this list, manage your profile @ >>> http://www.acfug.org?fa=login.edituserform >>> >>> For more info, see http://www.acfug.org/mailinglists >>> Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >>> List hosted by FusionLink <http://www.fusionlink.com> >>> ------------------------------------------------------------- >>> >> >> >> >> -- >> Steven Ross >> web application & interface developer >> http://blog.stevensross.com >> [mobile] 404-488-4364 [fax] (404) 592-6885 >> [ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ] >> >> ------------------------------------------------------------- >> To unsubscribe from this list, manage your profile @ >> http://www.acfug.org?fa=login.edituserform >> >> For more info, see http://www.acfug.org/mailinglists >> Archive @ http://www.mail-archive.com/discussion%40acfug.org/ >> List hosted by FusionLink <http://www.fusionlink.com> >> ------------------------------------------------------------- >> >> >> > > > -- > Steven Ross > web application & interface developer > http://blog.stevensross.com > [mobile] 404-488-4364 [fax] (404) 592-6885 > [ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ] > -- Steven Ross web application & interface developer http://blog.stevensross.com [mobile] 404-488-4364 [fax] (404) 592-6885 [ AIM / Yahoo! : zeriumsteven ] [googleTalk : nowhiding ] ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------