> 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.

Yes, it does, I see.
But this is not an easier (or a different) solution. I suspect that the
process of node creation is a rather slow thing. I've implemented something
like that and to create a node by a simple XPath expression it takes about
300-500ms. It's too much, in my opinion for a single node.

As I remeber in XForms expressions are restricted to be simple enough
(without predicate part). In this case it's not a difficult task to
implement a lightweight expression parser to update/add values by Simple
XPath:
    a/b
    a/b/c[1]
etc.

Btw, my name is Konstantin. Piroumian is the family name.

>
>
> 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]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to