Search elements with XPath
Eugene Prokopiev <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Hi,
I have this people.xml:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://localhost:8080/wsapp/services/PeopleService"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:portType name="PeopleService">
<wsdl:operation name="add" parameterOrder="name sex age"/>
<wsdl:operation name="getList"/>
<wsdl:operation name="del" parameterOrder="id"/>
</wsdl:portType>
</wsdl:definitions>
How can I find all wsdl:operation which are childs of wsdl:portType
name="PeopleService"?
I wrote:
var doc = document.implementation.createDocument("","",null);
doc.async = false;
doc.load("people.xml");
var services =
doc.evaluate("/definitions/portType@name='PeopleService'/operations",
doc, "http://schemas.xmlsoap.org/wsdl/", XPathResult.ANY_TYPE, null);
while (services.iterateNext()) {
alert(operation[i].getAttribute("name"));
alert(operation[i].getAttribute("parameterOrder"));
}
But I got:
Error: uncaught exception: [Exception... "Could not convert JavaScript
argument arg 2 [nsIDOMXPathEvaluator.evaluate]" nsresult: "0x80570009
(NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame ::
file:///home/john/devel/xul/wsdl/wsdl.js :: analize :: line 4" data: no]
What's wrong?
--
Thanks,
Eugene Prokopiev