Re: Xindice - Replace Node

sfurrh <[email protected]>
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
Nevermind, I figured it out:
			Update upd=new Update(Update.AFTER,xpath,xml);
			String updStr=upd.toString();
			System.out.println("update="+updStr);
			uservice.update(updStr);	
			
			Update rmv=new Update(Update.REMOVE,xpath+"["+matches+"]","");
			String rmvStr=rmv.toString();
			System.out.println("remove="+rmvStr);
			uservice.update(rmvStr);

Where my Update class is just a utility to generate the xupdate string and
"xml" is the new xml node and matches (in a while loop) is the index of the
matching node.



sfurrh wrote:
> 
> I am new to xindice and xmldb (though not new to xml) and I am wondering
> how I would go about replacing nodes.  Xupdate works fine if i want to
> replace the text content of a single node but how would I go about
> replacing an entire node that is not a collection.  For example:
> my collection looks like this:
>             <site xmlns:src="http://xml.apache.org/xindice/Query" id="1"
> src:col="/db/ArtSite" src:key="1">
>                 <config>
>                     <icon />
>                     <title>New Site</title>
>                 </config>
>                 <owner>sean</owner>
>                 <studio>
>                     <pieces />
>                 </studio>
>                 <preferences />
>             </site>
> 
> and i want to change the config node to look like this:
>                 <config>
>                     <icon>images/myicon.jpg</icon>
>                     <title>My great new site</title>
>                 </config>
> 
> how would I do it without simply iterating through all of the nodes and
> xupdating them individually?
> 
> thanks for any info.
> 
> Sean
> 
> 

-- 
View this message in context: http://www.nabble.com/Xindice---Replace-Node-tp17608708p17612662.html
Sent from the Xindice - Dev mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.