|
Mailing Lists
|
Home / Groups / XML
ColdFusion 8 problem with xmlsearch or malformed xml ?? access 2003 exported xmlI am having a CF8 problem reading an xml file exported from Access 2003. My array returned from the xmlsearch function is empty. I dump the xml doument I get a fully populated structure. If I validate the xml file with xmlvalidate() I get: 1 [Error] :2:91: cvc-elt.1: Cannot find the declaration of element 'dataroot'. Here is the code, and example of the xml file. Any ideas would be appreciated. Thanks, Bob <body> <cfset xml = XMLParse("http://aplacmc/dir/some.xml") /> <cfset contacts = XMLSearch(xml,'/Media_x0020_Contacts/id') /> <cfoutput> <!--- <cfdump var="#xml#"> ---> contacts<br /> <cfdump var="#contacts#"> <!--- xml<br /><cfdump var="#xml#"> ---> arraylen:#ArrayLen(contacts)# <br> <cfset myResults=XMLValidate(xml)> Dump of myResults structure returned by XMLValidate<br> <cfdump var="#myResults#"> <cfloop index="i" from="1" to="#ArrayLen(contacts)#"> Contact: #contacts[i].xmlchildren[1].xmltext# #contacts[i].xmlchildren[2].xmltext# /><br /> </cfloop> </cfoutput> </body> </html> ======== xml file =========== <?xml version="1.0" encoding="UTF-8"?> <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2008-05-20T14:02:27"> <Media_x0020_Contacts> <ID>163</ID> <Media_x0020_Name>media name</Media_x0020_Name> <Zip>0</Zip> <Fax_x0020_Group>0</Fax_x0020_Group> <selected>0</selected> </Media_x0020_Contacts> <Media_x0020_Contacts> <ID>1</ID> <Language>English</Language> <Media_x0020_Type>Print</Media_x0020_Type> <Media_x0020_Name>Austin American Statesman</Media_x0020_Name> <Last>Zipp</Last> <First>Fred</First> <Title>Managing Editor</Title> <E-mail_x0020_address>news@statesman.com</E-mail_x0020_address> <Work_x0020_phone>512-912-2983</Work_x0020_phone> <Fax>512-999-999</Fax> <URL>#http://www.statesman.com/#</URL> <Street_x0020_address>305 S. Congress Ave.</Street_x0020_address> <City>Austin</City> <ST>TX</ST> <Zip>78704</Zip> <Fax_x0020_Group>1</Fax_x0020_Group> <selected>0</selected> </Media_x0020_Contacts> </dataroot> |
May 18, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||