At 7:41 PM +0400 25/7/01, Piroumian, Konstantin wrote:
>I am trying to implement setValue() and addValue() and I'm faced a problem
>with XPath API. I am trying to find out is there a possibility for node
>insertion by an XPath expression. It seems that it's not possible with XPath
>API.
>Setting values is a simpler task: the node can be selected first then you
>can set its value by setNodeValue(). But what if the node is not present in
>the document? Say, you want to set a value by xpath 'a/b/c', but if you
>don't have 'a' and 'b' and 'c' node in your instance Document object then
>you have to parse XPath expression then iterate from root to the child and
>create every absend node.
>
>Maybe somebody knows an easier solution?
Just going back through all of this XForms stuff.
Piroumian, in the code for FP in Cocoon 1 at
org.apache.cocoon.processor.xsp.library.fp.fpResource there is a method
Object sureNode(String XPath)
Albeit a bit untidy, but it does this job.
regards Jeremy
--
___________________________________________________________________
Jeremy Quinn Karma Divers
webSpace Design
HyperMedia Research Centre
<mailto:[EMAIL PROTECTED]> <http://www.media.demon.co.uk>
<phone:+44.[0].20.7737.6831> <pager:[EMAIL PROTECTED]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]