OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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

> > 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
       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]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS