AS3 XML object that does not throw an exception if invalid data is specified?

I remember how gloomy that the XML class in AS3 throws an exception if you try to pass data to it in a constructor that is not a valid XML string. But now I got a case where XML happily accepts all kinds of data regardless of whether the XML is correct or not ...

var xml:XML;
try
{
    xml = new XML("Some bogus string content.");
    _valid = true;
}
catch (err:Error)
{
    _valid = false;
}

... am I missing something ??

Update: Qname is somehow null, but somehow it is not, see here:

var qname:QName = xml.name();
if (!qname.localName)
{
    _valid = false;
}

... throws an exception. Obvioulsy qname null! But...

var qname:QName = xml.name();
if (!qname || !qname.localName)
{
    _valid = false;
}

... does not raise any exceptions. It seems that qname is not null. Wth?

+3
source share
2 answers

XML nodeKind "text". XML. try/catch ().

+2

XML XML XML(). ()() XML. . XML XML() , XML .

+2

Source: https://habr.com/ru/post/1794353/


All Articles