Hi,

I am running Xindice 1.0 version.

I use the following program 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/text()";
            XPathQueryService service =
                (XPathQueryService) col.getService("XPathQueryService",
"1.0");
            ResourceSet resultSet = service.query(xpath);
     
            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, what I got was nothing when I print out the value of the XPath
expression: String xpath =                              
"//[EMAIL PROTECTED]'[EMAIL PROTECTED]']/Password/text()";

Why? Please help.

Regards,
longtai

-----Original Message-----
From: Vadim Gritsenko [mailto:[EMAIL PROTECTED] 
Sent: [EMAIL PROTECTED]|;M, 4 三月, 2004 PM 11:28
To: xindice-users@xml.apache.org
Subject: Re: {SPAM?} Re: How to retrieve element's value only?

Tan, Leong T wrote:

>It does not work....
>  
>

Can you be more specific? Are you running current CVS or earlier
version?

>By replacing 
>String xpath = "//[EMAIL PROTECTED]'[EMAIL PROTECTED]']/Password";
>With
>String xpath = "//[EMAIL PROTECTED]'[EMAIL PROTECTED]']/Password/text()"; 
>  
>


Vadim

Reply via email to