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