Skip to main content
Inspiring
November 16, 2007
Answered

XML - including: "<?xml version="1.0" encoding="UTF-8"?>"

  • November 16, 2007
  • 4 replies
  • 2590 views
When I parse an XML document and output:
#xmlCode.XMLRoot.property.autoID#

I get this line before every field: <?xml version="1.0" encoding="UTF-8"?>

eg.
<?xml version="1.0" encoding="UTF-8"?>
<autoID>19</autoID>
<?xml version="1.0" encoding="UTF-8"?>
<autoID>53</autoID>
<?xml version="1.0" encoding="UTF-8"?>
<autoID>59</autoID>

How do I stop this? I just want the number from the field.

I also don't understand why it is UTF-8 when I specify iso-8859-1.
This topic has been closed for replies.
Correct answer cjdunkerley
Doh!

rsPropDataXML.XMLRoot.property.autoID = <?xml version="1.0" encoding="UTF-8"?>
<autoID>19</autoID>


rsPropDataXML.XMLRoot.property.autoID.xmlText = 19

i.e. the .xmlText is the answer!

4 replies

cjdunkerleyAuthorCorrect answer
Inspiring
November 17, 2007
Doh!

rsPropDataXML.XMLRoot.property.autoID = <?xml version="1.0" encoding="UTF-8"?>
<autoID>19</autoID>


rsPropDataXML.XMLRoot.property.autoID.xmlText = 19

i.e. the .xmlText is the answer!
Inspiring
November 17, 2007
Thanks but it is still the same, every field has: <?xml version="1.0" encoding="UTF-8"?>

I am using CF8, MySQL5, DW CS3
Inspiring
November 17, 2007
If you use the CFXML tag, you dont need to do the <?xml version='1.0' encoding='iso-8859-1'?> line in your code. It will do it for you automatically.

Remove it and it should be fine.

EX:

<cfxml variable="rsPropDataXML" casesensitive="no">
<allData>
<cfoutput query="rsPropData" maxrows="20">
<property>
<autoID>#rsPropData.autoID#</autoID>
<Tour>#rsPropData.Tour#</Tour>
</property>
</cfoutput>
</allData>
</cfxml>


Inspiring
November 16, 2007
Please post your code