-
1. Re: get XML declaration
kglad May 20, 2009 2:48 PM (in response to tedalde2)1 person found this helpfulif you cast that data as an XMLDocument instance, you can use its xmlDecl property.
-
2. Re: get XML declaration
tedalde2 May 20, 2009 4:41 PM (in response to kglad)Why would I need to use a legacy class to do this? That seems equally silly. Is it because E4X syntax doesn't specify/require the declaration?
-
3. Re: get XML declaration
kglad May 20, 2009 5:14 PM (in response to tedalde2)i don't know if you need to but it solves the problem.
-
4. Re: get XML declaration
Greg Dove May 20, 2009 6:49 PM (in response to tedalde2)1 person found this helpfulYou can get the processingInstructions if they are not ignored during parsing (XML.ignoreProcessingInstructions=false) but NOT (apparently, it seems) xml processing instructions.
I don't know if its true, but according to : http://community.adobe.com/help/profile/index.html?id=553464C04456C36B9920157F, in the comments at the bottom of the page here:http://help.adobe.com/en_US/AS3LCR/Flash_10.0/XML.html
it's not relevant as as3 always uses version 1 and UTF-8 .
Either way, if you don't want to use kglad's approach- which does seem to be one viable option- and if you're loading it at runtime, you can easily get it before parsing, because it's simply the first part of the data string on the URLLoader before its parsed.
-
5. Re: get XML declaration
tedalde2 May 21, 2009 7:17 AM (in response to Greg Dove)So I can get the XML declaration through its string (but only BEFORE parsing; that stinks) or through the legacy XMLDocument class (which I haven't tried yet but will soon).
The XML comes externally and could theoretically have any encoding. Parts of the XML go into text fields onstage, so I want to check if I need to alter display fonts if XML isn't UTF-8.
Thanks
-
6. Re: get XML declaration
kglad May 21, 2009 7:30 AM (in response to tedalde2)yes. but i don't understand the problem.
even if there was some need to know the declaration, there's no significant effort required to determine the declaration.
-
7. Re: get XML declaration
tedalde2 May 21, 2009 9:58 AM (in response to kglad)The effort is the need to cast to XMLDocument/parse the string upon data receipt. You're right, it's not difficult. It's just a bad way of doing things. Now I have to insert something "special" at string-parse time just to get the declaration, then figure a way to remember that declaration in case it's needed elsewhere. I'm wondering why xmlDecl was removed from the XML class.
-
8. Re: get XML declaration
Wrataxas Dec 10, 2010 2:58 AM (in response to tedalde2)There is also the problem of how do you emit the XML tag when you write out an XML object. I'd like to save an XML file in the same format as the file I read in, i.e. including "<?xml version="1.0" encoding="UTF-8"?>" as the first line, and I haven't been able to figure out how to do that.