: [Flashcoders] Error check for parseXML()
Hi,
you should put the conditional in a callback, because when execution
reaches the conditional xml parsing might not have finished parsing.
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.parseXML(someTextVar);
xml.onLoad = function(success:Boolean
Hi,
you should put the conditional in a callback, because when execution
reaches the conditional xml parsing might not have finished parsing.
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.parseXML(someTextVar);
xml.onLoad = function(success:Boolean):Void {
if (xml.status == 0) {
Mendelsohn, Michael escreveu:
Hi list...
According to the help docs,
public parseXML(value:String) : Void
I think that when did you use :Void , the function doesn´t return any
value ...
try it
public parseXML(value:String):String { }
--
Gustavo Teider ( gugateider )
Mendelsohn, Michael schrieb:
Hi list...
According to the help docs,
public parseXML(value:String) : Void
doesn't return an integer or anything to indicate successful parsing of
the xml. How can I be certain that I've passed in some error free xml
and it was able to parse?
the XML-Object
How about xmlobj.status ?
If the xml is successfully loaded and parsed, you get 0 on the output
panel. Otherwise, you get a negative number (-2 , ... -10).
-2: A CDATA is not closed
-3: The initial XML declaration is malformed
-4: The DOCTYPE declaration is malformed
-5: A comment has no closed
Use the XML.status field.
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.parseXML(someTextVar);
if (xml.status == 0) {
trace(Success!);
} else {
trace(Error in XML! Code: + xml.status);
}
―
Mike Keesey
-Original Message-
From: [EMAIL PROTECTED]
6 matches
Mail list logo