简体   繁体   中英

Validating XML parser for Flex/actionscript?

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?

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.

I haven't heard of a DTD validator yet for as3, but I would like to. Meanwhile, can you not pass your xml to a server side script ( php or something ), validate it there and get the result ?

Interesting question though, I hope someone has a magic as3 dtd validation library lying around :).

没有内置支持,你必须自己动手或使用现有的库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM