[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Noob: XML validation capabilities beyond schemas
Liam R E Quin scripsit: > If your additional needs are met by W3C XML Schema (XSD), that would be > the way to go these days. XSD 1.1 is essentially the over-complicated replaced by the even more over-complicated. > > I am also investigating schematron. How powerful/limited is this? > > In some ways it's _too_ powerful (like awk). Well, the difficulty with using awk is that it's not easy to write text-processing programs that handle XML in the general case. Schematron uses an XML parser, so it doesn't have that problem. However, an interesting approach would be to use xgawk, which is an extension of GNU awk that processes an XML file as a sequence of SAX-style events rather than as a series of text lines. It uses Expat for the XML parsing, but the feel is that of awk: patterns and actions, not a pull-style processing loop (though that is available as well). Here's a sample xgawk program that determines the maximum element depth: @load xml XMLSTARTELEM { depth++ if (depth > max_depth) max_depth = depth } XMLENDELEM { depth-- } END { print max_depth } -- What has four pairs of pants, lives John Cowan in Philadelphia, and it never rains http://www.ccil.org/~cowan but it pours? cowan@ccil.org --Rufus T. Firefly
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|