commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Janoff <m...@janoff.de>
Subject [JXPath] Which type of object does "count()" return?
Date Tue, 06 Jan 2004 23:46:19 GMT
Hi there!

I'm using commons-jxpath-1.1. Everytime I try to execute

  context.getValue("count(//List/Item)")

I get a java.lang.ClassCastException.

The XML looks like this:

  <?xml version="1.0" encoding="UTF-8"?>
  <List>
    <Item>
      <Name>xyz</Name>
      <Name2>abc</Name>
    </Item>
  </List>

The code looks like this:

  JXPathContext context = JXPathContext.newContext(doc);
  // doc is a JDOM tree
  System.out.print("JXTest: ");
  System.out.println((String)context.getValue("count(//List/Item)"));

(I also tried Integer instead of String.)

Which type of object does the getValue() method return after "count"
has been executed?

Thanks for any hints!
Christian.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message