Lists Home |
Date Index |
> I don't believe that either and I'd add that it takes a pretty
> narrow view on XML but I can in fact see use cases for having access
> to types in XPath. For instance when I see an XSLT processor chew
> for several minutes on a very predictable document (granted, it's
> Java based, but still) I think that if it had access to schema
> information it could optimize a lot of what it's doing by skipping
> entire subtrees.
I know that's something that people claim quite a lot, but I don't
think that it's at all easy for an implementation to carry out that
level of optimisation, and I'm skeptical about whether you would
actually get the speed-up you're looking for.
Unless you've got really complicated stylesheets, a large proportion
of the time spent by an XSLT processor will be on parsing and building
up the node tree, especially if the document is so large that it has
to start swapping in order to find enough memory to store it. Having a
schema available will not help at this level.
[If this is what's causing the slow-down (you should be able to tell
from the timing information your processor gives you) I think that a
better approach is to plug a SAXFilter into your pipeline that does
the filtering out of the subtrees that you're not interested in.]
Then, as with all these kinds of optimisations, there's the question
of whether the time taken to perform the inferencing required to do
the optimisation is actually less than the time it's currently taking
to do the processing. I'd argue that in a well-designed stylesheet
(one that didn't apply templates to or otherwise visit the nodes in
the subtrees you want to ignore), the optimisation won't gain you
much, if anything. And it might bring you additional problems, such as
the famous optimising-away of tests that can't possibly be true
according to the schema.
> My issue here is that typing should be an option, available to those
> that want it but not enforced upon others. XML Schema has too many
> issues to be enforced upon anyone wishing to implement simple XPath.
I do agree with that. Choice between tools and technologies is a good