DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9575>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9575

count() returns wrong value





------- Additional Comments From [EMAIL PROTECTED]  2002-06-07 
14:18 -------
OK, let's do it in a namespace-guaranteed fashion: I parse it instead of 
construction. The problem still exists:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
String xmlStr = "<root xmlns=\"http://foo.org\"; />";
Document doc = db.parse(new java.io.ByteArrayInputStream(xmlStr.getBytes()));
CachedXPathAPI xpathAPI = new CachedXPathAPI();

// here I get the namespace
Attr attr = (Attr) xpathAPI.selectSingleNode(doc, "//namespace::*[1]");
XObject includeInResult = xpathAPI.eval(attr, "count(ancestor-or-self::node
())");
double val = includeInResult.num();
System.out.println("count(ancestor-of-self::node()) evaluates to " + val);

Reply via email to