commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject Re: Creating new element with JXPath
Date Tue, 01 Jul 2003 18:56:35 GMT
Ross,

If JXPath finds an element that matches the XPath, it simply returns
that element instead of creating a new one. 

You can take one of these two approaches: 
- introduce some distinguising feature for the new element, e.g.
      createPath("/form/input[@id='another']")
- use explicit indexing, e.g.
      createPath("/form/input[2]")

I hope this helps.

- Dmitri


--- Ross Bleakney <rossb@internationalcontent.com> wrote:
> I would like to create a new element with JXPath (even if an element
> with the same name exists). If I try to use
> JXPathContext.createPath(),
> it returns an existing element. For example, if I have the following
> XML:
> 
> <form>
>    <input type="text" id="existing" />
> </form>
> 
> and I want to add another <input> element, how can I do this?
> Thanks,
> Ross
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

Mime
View raw message