XML.status Property | Flash 5 | indicates whether parsing XML source into an object hierarchy was successful | read-only | Description The status property returns a numeric status code indicating whether any errors were encountered when parsing XML source code. The specified xmlDoc must be the top-level node in an XML object hierarchy (i.e., an instance of the XML class, not the XMLnode class). Parsing occurs when source XML is: -
Provided as an argument to the XML( ) constructor -
Passed to the parseXML( ) method -
Loaded into a new XML object via the load( ) or sendAndLoad( ) methods The status codes are shown in Table 18-27. If no errors were encountered in parsing, success is indicated by a status of 0. Errors are indicated by negative numbers. Parsing terminates once the first error is encountered, so other errors may surface even after you address previously reported errors. Table 18-27. XML parsing status codes 0 | The document parsed without errors (i.e., success). | -2 | A CDATA section was not properly terminated. | -3 | The XML declaration was not properly terminated. | -4 | The DOCTYPE declaration was not properly terminated. | -5 | A comment was not properly terminated. | -6 | An XML element was malformed. | -7 | Not enough memory to parse the XML source. | -8 | An attribute value was not properly terminated. | -9 | A start tag had no corresponding end tag. | -10 | An end tag had no corresponding start tag. | Normally, we use status to determine whether it's safe to proceed with processing an externally loaded XML file. Check the loaded property to ensure that a load( ) or sendAndLoad( ) command has completed before checking the status. Note that ActionScript's XML parser does not validate documents against DTDs; it only verifies well-formedness. ExamplemyDoc = new XML("<BOOK>Colin Moock</AUTHOR></BOOK>"); trace(myDoc.status); // Displays: "-10" (missing start tag) See Also XML.load( ), XML.loaded, XML.onLoad( ), XML.parseXML( ), XML.sendAndLoad( ) |