I have a XML document that I have to hard-code into AS (Yes, I HAVE to). I am trying to assign this xml to a string but for some reason on the xml doc declaration is assigned?!
var xmlDoc:String = '<?xml version="1.0" encoding="UTF-8"?>';
xmlDoc += '<?dctm xml_app=" ......
When I trace out the xmlDoc string I always only get “<?xml version=”1.0″ encoding=”UTF-8″?>”
I have tried putting the whole document in one string surrounded by ‘s and concatinating the string like above. Why is the string var only getting assigned to the first line?
I get the same result when trying to load the xml document directly from file
var xmlDocument:XML = new XML();
xmlDocument.load("myxml.xml");
xmlDocument.onLoad(success:Boolean)
{
if(success)
{
trace(xmlDocument.toString()); //Just the first line is printed
}
}
Thanks
couple things I see with the limited amount of the problem xml you posted
first you need to use spaces
// space before the last ?
Secondly, I forget what it is called but on your second line you are starting with a ? again where this should be your root node definition
To sum it up keep an eye on your spacing and don’t use question marks in your node names.
Also try to escape or you will have issues later on if you use cData