Re: Problem evaluating XPath expression into a NodeList

[email protected]
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <OF6FFCCE61.6F9ADB43-ON85257656.006ADD35-85257656.006B468C@lotus.com>
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 <[email protected]> wrote on 10/21/2009 02:00:02 PM:

> Tod <[email protected]> 
> 10/21/2009 02:00 PM
> 
> To
> 
> [email protected]
> 
> 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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.