Re: Search elements with XPath

Axel Hecht <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Eugene Prokopiev wrote:
> Another code:
> 
> var doc = document.implementation.createDocument("","",null);
> doc.async = false;
> doc.load("people.xml");
> var methods = doc.evaluate(
>    "/wsdl:definitions/wsdl:portType[@name='PeopleService']/wsdl:operation",
>    doc,
>    doc.createNSResolver(doc.documentElement),
>    XPathResult.ORDERED_NODE_ITERATOR_TYPE,
>    null
> );
> while (methods.iterateNext()) {
>    alert(methods.singleNodeValue);
> }
> 

singleNodeValue is only for UNORDERED_NODE_SNAPSHOT_TYPE or 
ORDERED_NODE_SNAPSHOT_TYPE, you want to do

var node;
while ((node = methods.iterateNext())) {
     alert(node);
}

Axel
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.