It might be of interest to look at the results in the following paper: http://homepages.inf.ed.ac.uk/fgeerts/pdf/pods05.pdf
In general, constructing a tree that satisfies a given XPath is undecidable. However, there are many fragments for which it can be solved, and perhaps some for which it can be solved efficiently. If you're looking at very simple expressions, e.g., a/b/c, it is trivial to build a tree. However, the difficulty increases with every feature that you want to accomodate. Axes, functions, and compatibility with a DTD/schema. HTH. -Nikhil On 12/16/08, Wim de Vries <wsvr...@xs4all.nl> wrote: > Even in theory it is not possible to create a DOM from an XPath expr, > because you cannot define nodes that are in negative conditions like > *[not(name="b"]. Or how about ancestor::x, where should x be in the tree? > > > Wim de Vries > Elsevier > > > > I can walk the DOM tree to create an xpath expression for a given > > node. I need to create a DOM from scratch using XPath expression. > > > > say, I have the expression /a/b/c such that DOM looks like: > > <a> > > <b> > > <c/> > > </b> > > </a> > > > > Is there any API that I can use to generate Such DOM using the XPath > > expression? > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > > For additional commands, e-mail: j-users-h...@xerces.apache.org > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org