在SoapUI中,我使用XPath来传输属性值,但始终显示为null

时间:2014-09-15 12:04:11

标签: xml xpath soapui

以下是我的XML数据

<Response xmlns"https://aaaa....">   
<Companies>
    <e>
        <Address>8/F Building </Address> 
        <Address2>. </Address2>         
        <BankAcctNo></BankAcctNo>        
        <BankBranchNo> </BankBranchNo>         
        <BankName> </BankName>         
        <City> </City>         
        <DisplayName> qwerty </DisplayName>         
        <DisplayName2/>         
        <Email/>         
        <FaxNo/>                  
        <IBAN/>                  
        <Locations>                     
            <e>                        
                <Code>11</Code>                        
                <Name>a</Name>                     
            </e>                     
            <e>                        
                <Code>l </Code>                        
                <Name>Branch </Name>                     
            </e>                  
        </Locations>                  
        <Makes>                     
            <e>                        
                <Code>Test</Code>                        
                <Name> test</Name>                     
            </e>                  
        </Makes>                  
        <Name> Test </Name>                  
        <PhoneNo/>                  
        <PostCode>876</PostCode>                  
        <Roles>                     
        <e>                        
            <Name>SalesPerson</Name>                     
        </e>                  
        </Roles>                  
        <SwiftBIC/>                  
        <VatRegNo/>                  
        <Web/>               
    </e>            
</Companies>            
<LoginResult>               
    <AccessToken> abc  </AccessToken>               
    <SessionToken>  bbb </SessionToken>            
</LoginResult>            
<SessionID null="true"/>            
<UserDetails>               
    <EmployeeNo> a </EmployeeNo>               
    <FirstName>qwe </FirstName>               
    <IsServiceAdvisor>true</IsServiceAdvisor>               
    <LastName>One</LastName>               
    <SalesPersonCode>SP1</SalesPersonCode>               
    <SalesPersonDiscount>0 </SalesPersonDiscount>            
</UserDetails>         
</Response>

我想将Makes-&gt; Code值传递给Xpath。

1 个答案:

答案 0 :(得分:1)

可能只是一个简单的//*:Makes/*:e[1]/*:Code就可以了。