You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Getty Images USA License <li...@gettyimages.com> on 2004/03/25 22:05:30 UTC

'Getty=001-606-675'How to specify the xupdate expression t o update the following xml?

Hello and thank you for your email. We strive to respond to all email inquiries within one business day. If your issue cannot wait that long, please call us at 877-438-8966. Our hours are 6:00 a.m. to 6:00 p.m. Pacific Standard Time, Monday through Friday. 

For reference, your assigned case ID is:1606675



-----Original Message-----
From: kc309@gre.ac.uk [kc309@gre.ac.uk]
Sent: Thursday, Mar 25 2004 1:01PM
To: xindice-users@xml.apache.org [xindice-users@xml.apache.org]
Subject: How to specify the xupdate expression to update the following xml?



If you are using Java, there's a method in XPathQueryService that allows you to 
query a specific document in a collection: XPathQueryService.updateResource 
(String docID, String query).  The doc id in your case would be 2001Exam.  As 
for the actual query, I'm not an XUpdate man so I can't help here.  Code 
fragment below: 

         String driver = "org.apache.xindice.client.xmldb.DatabaseImpl"; 
         Class c = Class.forName(driver); 
         
         Database database = (Database) c.newInstance(); 
         DatabaseManager.registerDatabase(database); 
         col = 
            DatabaseManager.getCollection("xmldb:xindice:///db/cc432"); 

         String update = "updatestring"; 
         String docID = "2001Exam"; 
         XUpdateQueryService service = 
            (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0"); 
         long count = service.updateResource(docID, update); 

Quoting "Tan, Leong T" <lt...@essex.ac.uk>: 

> Hi, 
> 
> I got the following problem: 
> 
> I got a collection named cc432 inside:  /db/cc432 
> 
> Then inside cc432 collection, I got five xml files. 
> There are as follows: 
> 
> 1) 2001Exam 
> 2) 2002Exam 
> 3) 2003Exam 
> 4) 2004Exam 
> 5) 2005Exam 
> 
> The 2001Exam xml file contains the following: 
> 
> <exam> 
> <section id="A"> 
> <question no="1" value="20"> 
>    <text>What is the largest planet in the solar system></text> 
> </question> 
> </section> 
> </exam> 
> 
> 
> I need to go inside 2001Exam xml file inside cc432 collection and change 
> 
> the following: 
> Change "<question no="1" value="20">" to "<question no="1" value="70">" 
> 
> How do I specify the xupdate query and how to I specify the xml file 
> "2001Exam"? 
> 
> Please advice and give me the sample codes. 
> 
> Thanks. 
> 
> Regards, 
> longtai 
> 





=======================================================
This email and its contents are confidential. If you
are not the intended recipient, please do not disclose
or use the information within this email or its
attachments. If you have received this email in error,
please delete it immediately. Thank you.
=======================================================