[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Noob: XML validation capabilities beyond schemas

  • From: John Cowan <cowan@mercury.ccil.org>
  • To: Liam R E Quin <liam@w3.org>
  • Date: Fri, 9 Dec 2011 15:14:47 -0500

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

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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.