2013-02-27 30 views
2

下面的內容是我的WSDL文件的一部分:如何解析WSDL文件中提取特定的節點

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 
- <wsdl:types> 
- <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> 
- <s:element name="BinaryConversion"> 
- <s:complexType> 
- <s:sequence> 
    <s:element minOccurs="0" maxOccurs="1" name="Binary" type="s:string" /> 
    </s:sequence> 
    </s:complexType> 
    </s:element> 
- <s:element name="BinaryConversionResponse"> 
- <s:complexType> 
- <s:sequence> 
    <s:element minOccurs="0" maxOccurs="1" name="BinaryConversionResult" type="s:string" /> 
    </s:sequence> 
    </s:complexType> 
    </s:element> 
- <s:element name="Qos"> 
- <s:complexType> 
- <s:sequence> 
    <s:element minOccurs="1" maxOccurs="1" name="Availabilty_10" type="s:int" /> 
    </s:sequence> 
    </s:complexType> 
    </s:element> 
- <s:element name="QosResponse"> 
    <s:complexType /> 
    </s:element> 
- <s:element name="GetQosParameters"> 
    <s:complexType /> 
    </s:element> 
- <s:element name="GetQosParametersResponse"> 
- <s:complexType> 
- <s:sequence> 
    <s:element minOccurs="1" maxOccurs="1" name="GetQosParametersResult" type="tns:QoSParameters" /> 
    </s:sequence> 
    </s:complexType> 
    </s:element> 
- <s:complexType name="QoSParameters"> 
- <s:sequence> 
    <s:element minOccurs="0" maxOccurs="1" name="Availability" type="s:string" /> 
    <s:element minOccurs="0" maxOccurs="1" name="Accuracy" type="s:string" /> 
    <s:element minOccurs="0" maxOccurs="1" name="Accessibility" type="s:string" /> 
    <s:element minOccurs="0" maxOccurs="1" name="Latency" type="s:string" /> 
    <s:element minOccurs="0" maxOccurs="1" name="Reliability" type="s:string" /> 
    </s:sequence> 
    </s:complexType> 
    </s:schema> 
    </wsdl:types> 

現在我想提取姓名的可用性,精確性延遲etc.How做我做這個。 我用文檔生成解析,但我只能夠提取WSDL:操作而不是WSDL:類型

回答

2

這裏是一個優秀的Java/XML教程(許多之一):

向下滾動到他談論的部分XPath。這是您獲取子節點(例如「QoSParameters」)及其中所有內容(例如「可用性」,「準確性」等)所需的語法。

+0

Tanq paul,但我使用NodeList elements = d.getElementsByTagName(「s:complexTypes」);它不工作,我的語法錯了,我能夠提取服務名稱,操作等,但不是complexTypes – renu 2013-02-27 03:00:52

相關問題