You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by David Rogers <da...@excira.com> on 2003/11/22 02:35:23 UTC

Insert using JXpath?


Hi,

Im using jxpath with jdom and im wondering if it is possible
to insert an element between two other elements. I thought
context.setValue("document/paragraph[3],new Element("paragraph")); for
examlple
would do it but this replaces the existing paragraph[3] with the new one..

I need to  insert...how can i do this...with jxpath?
Or should I just do it the jdom way?

Thanks,

-Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


RE: Insert using JXpath?

Posted by David Rogers <da...@excira.com>.
Hi,

Thanks for the reply but I am still  unclear on this.
I am concerned with the case were the path and leaf node
already exist when using a context.createPathAndSetValue(path, value) on a
JDOM.

Now if value is a string, i expect that the text of the existing leaf node
will be replaced with the string in value. -fine.

However, if value is a JDOM Element, then should the Element
be inserted at the specified index (rather than replace the existing
Element)?
Is this correct? Or how do i do an insert. (not a replace)

Is this behavior meant to be implemented in the createObject method of the
AbstractFactory?
If so maybe that is my problem, as i wrote my own JDOMFactory extending
AbstactFactory.

Is there a "standard" implementation of AbstractFactory for JDOM or DOM? I
looked but
could not find one.

Thanks,
Dave





-----Original Message-----
From: Dmitri Plotnikov [mailto:dmitri@apache.org]
Sent: Sunday, November 23, 2003 3:05 PM
To: Jakarta Commons Users List
Subject: Re: Insert using JXpath?


The APIs to insert a node is context.createPathAndSetValue(path, value)

- Dmitri

----- Original Message -----
From: "David Rogers" <da...@excira.com>
To: <co...@jakarta.apache.org>
Sent: Friday, November 21, 2003 8:35 PM
Subject: Insert using JXpath?


>
>
> Hi,
>
> Im using jxpath with jdom and im wondering if it is possible
> to insert an element between two other elements. I thought
> context.setValue("document/paragraph[3],new Element("paragraph")); for
> examlple
> would do it but this replaces the existing paragraph[3] with the new one..
>
> I need to  insert...how can i do this...with jxpath?
> Or should I just do it the jdom way?
>
> Thanks,
>
> -Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Insert using JXpath?

Posted by Dmitri Plotnikov <dm...@apache.org>.
The APIs to insert a node is context.createPathAndSetValue(path, value)

- Dmitri

----- Original Message ----- 
From: "David Rogers" <da...@excira.com>
To: <co...@jakarta.apache.org>
Sent: Friday, November 21, 2003 8:35 PM
Subject: Insert using JXpath?


>
>
> Hi,
>
> Im using jxpath with jdom and im wondering if it is possible
> to insert an element between two other elements. I thought
> context.setValue("document/paragraph[3],new Element("paragraph")); for
> examlple
> would do it but this replaces the existing paragraph[3] with the new one..
>
> I need to  insert...how can i do this...with jxpath?
> Or should I just do it the jdom way?
>
> Thanks,
>
> -Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org