Glen,

   We created client code that does exactly what you're describing here.  We
adopted Jaxen about 9 months ago (pre-FCS) so our code probably needs to be
revisited to work against the latest library.  If you'd like to take a look
at our source code, let me know...

-Ron

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Glen
Lewis
Sent: Tuesday, September 17, 2002 9:35 AM
To: [EMAIL PROTECTED]
Subject: [Jaxen] creating nodes from an xpath


I would like to start with an XPath, like "/a/b/c", and then have a document
node be populated with any path nodes that don't exist.  So, if the document
root was an element <a> with no children, an empty child element <b> and
grandchild <c> would be added.  Doesn't look like I can use the Jaxen APIs
to do this though.

I assumed I would need to write an algorithm that iterates an XPath by its
'steps', checking whether the current step matches any Nodes.  If no match
is found, the algorithm would create a new child node corresponding to the
current step.

Is there anything in the APIs that will allow me iterate the steps of an
XPath expression in this manner?

thanks!
Glen Lewis

PS - I know someone will ask "why?"  I built a framework that uses java
beans whose get/set methods use XPaths to get/set Element.text or
Attribute.value in a document.  Problem is, sometimes the document has no
value - in which case I'd like to "fill it out" with the Elements and
Attributes expected by my XPath, and then store the bean value.



-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest



-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to