Steven thank you for the reply. Mixed results. One worked, one did
not, haven't tried accessing the multiple children (yet).
Accessing the struct item (link/href) works fine. In fact, I gave
that a whirl later in the night after sending this message ...
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImportRentMktCom[i][2] = selectedElements
[i].link.XmlAttributes.href;
Handling the fn:image is still a problem however ...
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
arrayImportRentMktCom[i][3] = selectedElements[i].
["fn:image"].XmlText;
The above gives an error ===> Problem occurred while parsing,
Encountered "[" at line: 10, column: 70
Tried with and without square brackets, and with quotes only. No
luck. What am I missing here?
_____________
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 8:26 AM, Steven Ross wrote:
to reference fn:image I believe you would do the same as when you
want to preserve the case of a struct and use brackets and the name
ie: XMLDoc["fn:image"].XMLText
multiple child elements of the same name... thats kinda tricky but,
it would be easy enough to select only the child nodes of a
specific node with XMLSearch and specifying the relative path to
the node ie: XMLSearch(thexml, "//parentnode/duplicatenodename")
XMLAttributes property will give you the attributes of a node...
syntax is NodeName.XMLAttributes.attributeName
-Steven
On Tue, Jun 10, 2008 at 11:30 PM, Derrick Peavy
<[EMAIL PROTECTED]> wrote:
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.
___________________________________
--
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
-------------------------------------------------------------