probably try //[EMAIL PROTECTED]'[EMAIL PROTECTED]']/Password/text()
instead..


On Thu, 2004-03-04 at 14:42, Tan, Leong T wrote:
> Hi,
> 
> I used to follow code to get the value of password element:
> 
> public static void main(String[] args) throws Exception {
>         Collection col = null;
>         try {
>             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/User");
> 
>             String xpath = "//[EMAIL PROTECTED]'[EMAIL PROTECTED]']/Password";
>             XPathQueryService service =
>                 (XPathQueryService) col.getService("XPathQueryService",
> "1.0");
>             ResourceSet resultSet = service.query(xpath);
>             /*if (resultSet.getSize()!=1){
>                 System.out.println( "wrong");
>             }
>             else{
>  
> System.out.println(resultSet.getResource(0).getContent());
>             }
>  
>             ResourceIterator results = resultSet.getIterator();
>             
>             while (results.hasMoreResources()) {
>                 Resource res = results.nextResource();
>                 System.out.println((String) res.getContent());
>             }
>             
>         }
>         catch (XMLDBException e) {
>             System.err.println("XML:DB Exception occured " +
> e.errorCode);
>         }
>         finally {
>             if (col != null) {
>                 col.close();
>             }
>         }
>     }
> 
> //--------------------------------------------------------------
> 
> However it return the result:
> 
> <?xml version="1.0"?>
> <Password xmlns:src="http://xml.apache.org/xindice/Query";
> src:col="/db/User" src:key="alienUser">1234567
> </Password>
> 
> I just want to value "1234567" but without the element tag, how should I
> do it?
> 
> Regards,
> longtai
-- 
Yue(Eric) Zhang
Database Analyst/DBA, TAPoR Project
Arts Department, University of Alberta
Edmonton, AB, Canada

Reply via email to