0

我从 Web 服务收到以下 SOAP 响应。

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<cxmla:ExecuteResponse xmlns:cxmla="urn:schemas-microsoft-com:xml-analysis">
  <cxmla:return>
    <root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:EX="urn:schemas-microsoft-com:xml-analysis:exception">
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:schemas-microsoft-com:xml-analysis:rowset" xmlns="urn:schemas-microsoft-com:xml-analysis:rowset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sql="urn:schemas-microsoft-com:xml-sql" elementFormDefault="qualified">
        <xsd:element name="root">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element maxOccurs="unbounded" minOccurs="0" name="row" type="row"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:simpleType name="uuid">
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"/>
          </xsd:restriction>
        </xsd:simpleType>
        <xsd:complexType name="row">
          <xsd:sequence>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Funding_x0020_Entity_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Funding Entity].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Program_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Program].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Currency_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Currency].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Term_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Term].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Sequence_x0020_Number_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Sequence Number].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Rate_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Rate].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Outstanding_x0020_Total_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Outstanding Total].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Sales_x0020_Total_amt_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Sales Total_amt].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Yield_x0020_Pct_rate_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Yield Pct_rate].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Counterparty_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Counterparty].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Account_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Account].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Contact_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Contact].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Cusip_x0020_Num_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Cusip Num].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Price_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Price Amt].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Payoff_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Payoff Amt].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_maturitydt_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[maturitydt].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Key_x0020_Date_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Key Date].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Custodian_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Custodian].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Int_x0020_Disc_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Int Disc Amt].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_IPA_x0020_code_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[IPA code].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Settlement_x0020_Status_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Settlement Status].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Source_x0020_Code_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Source Code].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Trade_x0020_ID_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Trade ID].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Trade_x0020_Type_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Trade Type].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Branch_x005d_._x005b_MEMBER_CAPTION_x005d_" sql:field="[TRD.New Hierarchy 0].[Branch].[MEMBER_CAPTION]" type="xsd:string"/>
            <xsd:element minOccurs="0" name="_x005b_Measures_x005d_._x005b_RATE_x005d_" sql:field="[Measures].[RATE]"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:schema>
          <row>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Funding_x0020_Entity_x005d_._x005b_MEMBER_CAPTION_x005d_>FSC</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Funding_x0020_Entity_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Program_x005d_._x005b_MEMBER_CAPTION_x005d_>FSCUS3A3</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Program_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Currency_x005d_._x005b_MEMBER_CAPTION_x005d_>USD</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Currency_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Term_x005d_._x005b_MEMBER_CAPTION_x005d_>2</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Term_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Sequence_x0020_Number_x005d_._x005b_MEMBER_CAPTION_x005d_>70</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Sequence_x0020_Number_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Rate_x005d_._x005b_MEMBER_CAPTION_x005d_>0.140000000000000000</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Rate_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Outstanding_x0020_Total_x005d_._x005b_MEMBER_CAPTION_x005d_>34000000.0000</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Outstanding_x0020_Total_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Sales_x0020_Total_amt_x005d_._x005b_MEMBER_CAPTION_x005d_>33998942.2200</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Sales_x0020_Total_amt_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Yield_x0020_Pct_rate_x005d_._x005b_MEMBER_CAPTION_x005d_>0.140004000000000000</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Yield_x0020_Pct_rate_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Counterparty_x005d_._x005b_MEMBER_CAPTION_x005d_>MLAM</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Counterparty_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Account_x005d_._x005b_MEMBER_CAPTION_x005d_>RAT         </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Account_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Contact_x005d_._x005b_MEMBER_CAPTION_x005d_>Jones, Richard</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Contact_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Cusip_x0020_Num_x005d_._x005b_MEMBER_CAPTION_x005d_>74432KT32   </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Cusip_x0020_Num_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Price_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_>99.996888882353000000</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Price_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Payoff_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_>34000000.0000</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Payoff_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_maturitydt_x005d_._x005b_MEMBER_CAPTION_x005d_>06-03-2011</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_maturitydt_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Key_x0020_Date_x005d_._x005b_MEMBER_CAPTION_x005d_>Jun  1 2011 12:00AM</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Key_x0020_Date_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Custodian_x005d_._x005b_MEMBER_CAPTION_x005d_>00005170    </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Custodian_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Int_x0020_Disc_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_>1057.7800</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Int_x0020_Disc_x0020_Amt_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_IPA_x0020_code_x005d_._x005b_MEMBER_CAPTION_x005d_>CITI        </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_IPA_x0020_code_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Settlement_x0020_Status_x005d_._x005b_MEMBER_CAPTION_x005d_>N </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Settlement_x0020_Status_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Source_x0020_Code_x005d_._x005b_MEMBER_CAPTION_x005d_>MN          </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Source_x0020_Code_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Trade_x0020_ID_x005d_._x005b_MEMBER_CAPTION_x005d_>20111520000070</_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Trade_x0020_ID_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Trade_x0020_Type_x005d_._x005b_MEMBER_CAPTION_x005d_>US3A3CP     </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Trade_x0020_Type_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Branch_x005d_._x005b_MEMBER_CAPTION_x005d_>US          </_x005b_TRD.New_x0020_Hierarchy_x0020_0_x005d_._x005b_Branch_x005d_._x005b_MEMBER_CAPTION_x005d_>
        <_x005b_Measures_x005d_._x005b_RATE_x005d_ xsi:type="xsd:double">0.14</_x005b_Measures_x005d_._x005b_RATE_x005d_>
      </row>
    </root>
  </cxmla:return>
</cxmla:ExecuteResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我试图取消标签中使用的xHHHH以取回值。我正在使用 SAAJ 库进行 SOAP 处理。除了编写用于反向转义的代码之外,我还有哪些选择。

最好的,罗汉

4

1 回答 1

0

好吧,我实现了一个方法来做到这一点。但我仍然想知道任何库中是否有标准可以做到这一点。

 private Pattern s_hexPattern = Pattern.compile("_x([A-Fa-f0-9]{4})_"); 
  public String convertHexToString ( String str ) {

    Matcher m = s_hexPattern.matcher(str);
    while ( m.find() ){
        int decimal = Integer.parseInt(m.group(1), 16);
        str = str.replace(m.group() , (char)decimal + "" ) ;
    }

    return str;
    }

最好的,罗汉

于 2012-04-12T16:01:42.680 回答