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" <[EMAIL PROTECTED]>:

> 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 
> 




Reply via email to