This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Mozilla XML > August 2005 > XML Parsing
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Eugene Prokopiev 2005-08-09, 7:45 pm |
| Hi,
I have file people.wsdl:
<?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>
I need to get all wsdl:portType and all wsdl:operation for every
wsdl:portType.
Code:
var doc =
document.implementation.createDocument("http://schemas.xmlsoap.org/wsdl/","wsdl",null);
doc.load("people.wsdl");
var definitions = doc.getElementsByTagName("definitions");
alert(definitions[0].getAttribute("targetNamespace"));
var portType = doc.getElementsByTagName("portType");
alert(portType[0].getAttribute("name"));
var operation = doc.getElementsByTagName("operation");
for(var i=0; i<portType.length; i++) {
alert(operation[i].getAttribute("name"));
}
On line 4 I got error:
Error: definitions[0] has no properties
What's wrong?
Can I use XPath expressions like this:
getElementsByTagName("/definitions/portType/operation[0]") ?
--
Thanks,
Eugene Prokopiev
| |
| Axel Hecht 2005-08-10, 7:29 am |
| Eugene Prokopiev wrote:
> Hi,
>
> I have file people.wsdl:
>
> <?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>
>
> I need to get all wsdl:portType and all wsdl:operation for every
> wsdl:portType.
>
> Code:
>
> var doc =
> document.implementation.createDocument("http://schemas.xmlsoap.org/wsdl/","wsdl",null);
>
> doc.load("people.wsdl");
This is async, the rest of the code needs to go into the onload handler.
See http://www.mozilla.org/projects/xslt/js-interface.html for sample code.
Axel
| |
| Eugene Prokopiev 2005-08-10, 7:29 am |
| >> var doc =
>
>
> This is async, the rest of the code needs to go into the onload handler.
> See http://www.mozilla.org/projects/xslt/js-interface.html for sample code.
Thanks
Where can I read about Document events? Has it error event? How can I
handle it?
Why this code don't show alert:
var doc = document.implementation.createDocument("","",null);
doc.addEventListener("load", onload, true);
doc.load("people.wsdl");
function onload() {
alert(doc);
}
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|