First off, I am really light on using XML in CF. Having said
that...I have to parse an XML document to use some of the
information and loop it on a physician profile page. Using an
example from a blog site, I am attempting (badly) to grab just the
title, author, link, and category and put them into a temp
recordset so I can display them on a page. Course it doesn't work.
Please help, client department is getting edgy and this is
the last thing I have to do for them. THANKS!
Here is the script block:
<cfhttp url="
http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Search&db=pubmed&term=%28weadock%20WJ%5BAuthor%5D%...
method="GET" />
<cfscript>
xmlfile = xmlparse(cfhttp.filecontent); //Parses the XML
/xmlsize = arraylen(xmlfile.item.xmlchildren); //item is the
parent tree
xmlqry = QueryNew("title, link, author, category"); //Sets a
query for output
QueryAddRow(xmlqry,xmlsize);
for(a=1;a LTE xmlsize;a=a+1) {
QuerySetCell(xmlqry,"title",xmlfile.item
.Title.xmlText,a);
QuerySetCell(xmlqry,"link",xmlfile.item.link.xmlText,a);
QuerySetCell(xmlqry,"author",xmlfile.item.Author.xmlText,a);
QuerySetCell(xmlqry,"category",xmlfile.item.category.xmlText,a);
}
</cfscript>
Here is the actual XML doc I am getting back: