R – Validating XML parser for Flex/actionscript

actionscript-3apache-flexparsingvalidationxml

Is there a validating XML parser for flex/actionscript? The XML class verifies that it is well formed XML, but not that it follows the rules of the DTD. Java has a validating XML parser, but is there one for flex/actionscript?

Best Answer

Ok, good news, bad news time.

First the bad news: Unfortunately, no. Actionscript does not support any form of DTD validation. It also does not support any form of XSL/XSLT validation or transformation. There are projects out there which will eventually make some of this possible (XPath-AS3 for one), but for now you are stuck out of luck.

But, there is good news (sort of): First, most servers support both. This means that you could accomplish the same thing in Flash using a round-trip to the server. It is, perhaps, less than ideal, especially when dealing with large amounts of information, but it will guarantee consistent results.

Second, JavaScript supports both XSL and DTD functionality This means, if absolutely necessary, you have the ability to us ExternalInterface to force the transformations for you (and you could even adapt the JavaScript/HTML abilities on Adobe Air to do the same). This, of course, means that you will need to do even more cross-browser testing.

Sorry there is no better news.