questhaven
asked on
Coldfusion and XML - need assistance reading XML values - am desperate!
I'm afraid I have virtually no experience working with XML & Coldfusion, so any advice that anyone can provide would be great. I am trying to grab a web page and get the certain values into a database. The web page I am calling with <cfhttp> is a php file that returns contents as XML.
i.e.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE workspace PUBLIC "-//workname//DTD workspace 1.0" "http://localhost:8080/workspace/p.dtd">
<working type="d">
<off><u>132915</u></off>
</working>
<working type="d">
<on><u>132915</u></on>
</working >
<working type="d">
<off><u>13112</u></off>
</working>
I am totally baffled as to how to accomplish getting the values for which numbers come across as <off></off> and which come across as <on></on> read out of the xml and into a usuable format. If you need more information or I am not clear on this, please just let me know!
Thanks!
i.e.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE workspace PUBLIC "-//workname//DTD workspace 1.0" "http://localhost:8080/workspace/p.dtd">
<working type="d">
<off><u>132915</u></off>
</working>
<working type="d">
<on><u>132915</u></on>
</working >
<working type="d">
<off><u>13112</u></off>
</working>
I am totally baffled as to how to accomplish getting the values for which numbers come across as <off></off> and which come across as <on></on> read out of the xml and into a usuable format. If you need more information or I am not clear on this, please just let me know!
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi there:) No problem, great to help and thanks for the example code, it's in my snippets folder now :)
ASKER
<cfscript>
onList = "";
if (findNoCase("<on>", xmlString))
{
onList = removeChars(xmlString, 1, findNoCase("<on>", xmlString) + 6);
onList = replaceNoCase(removeChars(
}
offList = "";
if (findNoCase("<off>", xmlString))
{
offList = removeChars(xmlString, 1, findNoCase("<off>", xmlString) + 7);
offList = replaceNoCase(removeChars(
}
</cfscript>