Insufficient data. What does the input document look like and what is your XPath?
______________________________________ "... Three things see no end: A loop with exit code done wrong, A semaphore untested, And the change that comes along. ..." -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish ( http://www.ovff.org/pegasus/songs/threes-rev-11.html) Tod <listac...@gmail.com> wrote on 10/21/2009 02:00:02 PM: > Tod <listac...@gmail.com> > 10/21/2009 02:00 PM > > To > > xalan-j-users@xml.apache.org > > cc > > Subject > > Problem evaluating XPath expression into a NodeList > > I have a class that evaluates an XPath expression against an XML stream > with multiple namespaces and returns a NodeList. I know by looking at > the XML that the node I am retrieving is composed of 20 elements, called > '<summary>'. I also know that two of those elements have no value. The > relevant code looks like this: > > > XML2Doc xmldoc = new XML2Doc(getXmlFile()); > Document domTree = (Document) xmldoc.getDoc(); > domTree.getDocumentElement().normalize(); > NamespaceResolver myResolver = new NamespaceResolver(); > XObject xObj = XPathAPI.eval(domTree,getXpathExp(),myResolver); > NodeList = xObj.nodelist(); > > > > > > The problem I am running into is that of the 20 <summary> elements some > are empty (<summary type="html"></summary>). Upon evaluating the XPath > expression the NodeList returned only 18 items event though I know there > are twenty. It seems that the elements that weren't valued became > insignificant as the NodeList was generated. > > Is this the correct behavior? I'm expecting my NodeList to have the > same number of <summary> elements because I'll be matching them against > their related <title> elements during presentation time. Perhaps there > is something I need to do in my code to establish the fact that empty > elements are significant and should be included in the NodeList? I > tried removing the normalize() call but that didn't help. > > To make things more interesting I am developing this code using JDK > 1.4.2 because that it is the development environment the customer is > using and requires. > > > Thanks - Tod >