xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nutter <David.Nut...@durham.ac.uk>
Subject Re: XPath to generate XML
Date Wed, 02 Oct 2002 08:54:05 GMT
On Tue, Oct 01, 2002 at 11:53:15AM -0400, Joseph Kesselman wrote:
> So you're only going to create _a_ matching document, and not necessarily 
> the one you had in mind... especially as the XPath becomes more complex 
> and/or you want to apply several of these create calls in succession to 
> build up the document you're interested in. (If I attempt to create that 
> same XPath again, do I reuse the existing bar and/or baz or create new 
> ones?)

I was playing with this a while back as a way of quickly creating a
conformant document without the overhead of parsing DTDs and working
out a minimal document, running into some of the problems you
describe[1]. I switched away from using it since it was simpler (and
quicker) to keep a a parsed minimal document around and clone it as
necessary. Anyway, I produced a messy experimental class called
XPathCreator and a fairly minimal set of test cases for it. 

It requires the Apache ORO regular expression classes, JUnit and Xalan
2.4. I've attached the code if anyone wants to fiddle with it. 



[1] I planned to fix some of them by (ahem) tweaking the semantics of
certain XPath functions. For example text() now creates a text node if
one doesn't exist. This is explained a bit more in the comments; in
particular I intended to make position() create nodes as necessary. 

David Nutter <david.nutter@durham.ac.uk>	Research Assistant
Rm E326, Department Of Computer Science, 
University Of Durham, 
Durham, DH1 3LE			 Tel: +44(0)191 3747075

View raw message