Re: Schema Design: Composition vs Subclassing

> But I still don't have a clear idea as
> to what the limits are on SAX's ability to evaluate XPath expressions. Is
> there a good reference on this somewhere?

I have seen several different approaches but most end up building the
document in memory. Neils Peter Strandberg wrote a SAX filter that cuts a
document into fragments based on XPath:

http://www.npstrandberg.com/projects/saxxpathfragmentfilter/

This technique seems promising.

> The question comes again,
> can SAX-based XPath evaluators retain enough context to evaluate such
> expressions without retaining the entire DOM?

Its funny you asked that-- I was wondering the same thing. If one wanted to
evaluate a Schematron assertion, then for any given assertion it seems that
you don't need the whole document. You may not even need to process _whole
document_. For example,

<rule context="Element1">
  <assert test="not(@att1) or (@att1 and @att2)">no single att1</assert>
</rule>

Here the rule comes in force only in the context of an Element1. Then you
come to the simple logic of has both (att1 and att2) or no att1 attributes.
SAX makes this easy because it offers all attributes but this is possible in
cardinality too:

<rule context="Element1">
  <assert test="not(ch1) or (ch1 and ch2)">no single ch1</assert>
</rule>

Here you push a Schematron rule onto the stack at the entry to the context.
The rule consists of three conditions and two logical components. At the end
of the context (endElement) the rule could be evaluated based on the
satisfied (or not) conditions. It would be difficult to create a general
handler for reporting rule violations as they happen (in the above rule the
entire context would possibly need to be completed before establishing that
a ch2 element did not exist within that context)

I too am interested to find out if anyone has had a go at this... it sounds
fun...

Cheers,
Jeff Rafter

Received on Wednesday, 24 April 2002 18:57:07 UTC