You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by dave <ce...@yahoo.com> on 2008/02/07 04:39:56 UTC

search and replace kind of operations with XML

For a given XML input, I would need to perform 'Search
and Replace' operation on Element/Attribute Tag names
and values. The resultant output is a transformed XML.
Since I would like to change both Tags and Values,
what is the best way to accomplish this? XSLT or
Xpath/XQuery or combination of both?

 OR are there any special apis in XmlBeans to
accomplish this?



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


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


RE: search and replace kind of operations with XML

Posted by Radu Preotiuc-Pietro <ra...@bea.com>.
You can do this in XmlBeans by using the XmlCursor.setName() and
XmlCursor.setTextValue() methods. This is the most efficient way and
it's easy enough to code, IMO.

Alteratively, XMLBeans supports XQuery via Saxon integration, but, as
far as I know, in XQuery you can't change a document "in-place" and you
basically need to create a new doc with everything from the original doc
in it, except the elements which now need to have new names. Way more
trouble than it's worth.

Radu

> -----Original Message-----
> From: dave [mailto:ceek63@yahoo.com] 
> Sent: Wednesday, February 06, 2008 7:57 PM
> To: user@xmlbeans.apache.org; xmlschema-dev@w3.org
> Subject: Re: search and replace kind of operations with XML 
> 
> 
> Am already using XmlBeans. I would need to see how I can 
> integrate VTD-XML with XMLBeans.
> 
> I agree with you that VTD-XML is an ideal match for what I 
> want to accomplish. I would still prefer if XmlBeans offers 
> anything on this line. 
> 
> Thanks Jimmy.
> 
> dave
> --- jimmy Zhang <jz...@ximpleware.com> wrote:
> 
> > I think you may find VTD-XML ideally suited for this 
> (better than any 
> > other technologies AFAIK ) because of its incremental update 
> > capability and built-in XPath
> > 
> >
> http://www.javaworld.com/javaworld/jw-07-2006/jw-0724-vtdxml.html
> > 
> > http://www.devx.com/xml/Article/36379
> > 
> > 
> > ----- Original Message -----
> > From: "dave" <ce...@yahoo.com>
> > To: <us...@xmlbeans.apache.org>;
> > <xm...@w3.org>
> > Sent: Wednesday, February 06, 2008 7:39 PM
> > Subject: search and replace kind of operations with XML
> > 
> > 
> > >
> > > For a given XML input, I would need to perform
> > 'Search
> > > and Replace' operation on Element/Attribute Tag
> > names
> > > and values. The resultant output is a transformed
> > XML.
> > > Since I would like to change both Tags and Values,
> > > what is the best way to accomplish this? XSLT or
> > > Xpath/XQuery or combination of both?
> > >
> > > OR are there any special apis in XmlBeans to
> > > accomplish this?
> 
> 
>       
> ______________________________________________________________
> ______________________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

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


Re: search and replace kind of operations with XML

Posted by dave <ce...@yahoo.com>.
Am already using XmlBeans. I would need to see how I
can integrate VTD-XML with XMLBeans.

I agree with you that VTD-XML is an ideal match for
what I want to accomplish. I would still prefer if
XmlBeans offers anything on this line. 

Thanks Jimmy.

dave
--- jimmy Zhang <jz...@ximpleware.com> wrote:

> I think you may find VTD-XML ideally suited for this
> (better than any
> other technologies AFAIK ) because of its
> incremental update capability and 
> built-in
> XPath
> 
>
http://www.javaworld.com/javaworld/jw-07-2006/jw-0724-vtdxml.html
> 
> http://www.devx.com/xml/Article/36379
> 
> 
> ----- Original Message ----- 
> From: "dave" <ce...@yahoo.com>
> To: <us...@xmlbeans.apache.org>;
> <xm...@w3.org>
> Sent: Wednesday, February 06, 2008 7:39 PM
> Subject: search and replace kind of operations with
> XML
> 
> 
> >
> > For a given XML input, I would need to perform
> 'Search
> > and Replace' operation on Element/Attribute Tag
> names
> > and values. The resultant output is a transformed
> XML.
> > Since I would like to change both Tags and Values,
> > what is the best way to accomplish this? XSLT or
> > Xpath/XQuery or combination of both?
> >
> > OR are there any special apis in XmlBeans to
> > accomplish this?


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

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


Re: search and replace kind of operations with XML

Posted by jimmy Zhang <jz...@ximpleware.com>.
I think you may find VTD-XML ideally suited for this (better than any
other technologies AFAIK ) because of its incremental update capability and 
built-in
XPath

http://www.javaworld.com/javaworld/jw-07-2006/jw-0724-vtdxml.html

http://www.devx.com/xml/Article/36379


----- Original Message ----- 
From: "dave" <ce...@yahoo.com>
To: <us...@xmlbeans.apache.org>; <xm...@w3.org>
Sent: Wednesday, February 06, 2008 7:39 PM
Subject: search and replace kind of operations with XML


>
> For a given XML input, I would need to perform 'Search
> and Replace' operation on Element/Attribute Tag names
> and values. The resultant output is a transformed XML.
> Since I would like to change both Tags and Values,
> what is the best way to accomplish this? XSLT or
> Xpath/XQuery or combination of both?
>
> OR are there any special apis in XmlBeans to
> accomplish this?
>
>
>
> 
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now. 
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
> 



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