使用local-name()值解决的xpath

时间:2015-05-08 07:53:09

标签: xml xpath namespaces

我有这个xml需要使用xpath解析 我想知道我怎么能得到xpath,这将从父母那里给我孩子的价值我从

获得父节点值
//*[local-name()='BucketCategory']

但需要BucketBalance的值,以便我可以动态使用它 XML是

<xsdLocal1:T2BucketBalanceResponse xmlns:xsdLocal1="http://www.tele2.com/T2BucketBalanceResponse_05.00">
<xsdLocal1:Header>
    <xsdLocal1:MessageId>654321</xsdLocal1:MessageId>
    <xsdLocal1:ConversationId>2aeba17d-e9c2-11e4-b061-f5ff8e3ab34b</xsdLocal1:ConversationId>
    <xsdLocal1:BusinessProcessId/>
    <xsdLocal1:MessageTargetNamespace>http://www.tele2.com/T2BucketBalanceResponse</xsdLocal1:MessageTargetNamespace>
    <xsdLocal1:MessagePriority>4</xsdLocal1:MessagePriority>
    <xsdLocal1:Timestamp>2015-05-01 09:26:12.887</xsdLocal1:Timestamp>
    <xsdLocal1:Sender>TIP</xsdLocal1:Sender>
    <xsdLocal1:Recipient>SiebelCRM_NL</xsdLocal1:Recipient>
    <xsdLocal1:LegalEntity>27</xsdLocal1:LegalEntity>
    <xsdLocal1:PayloadEncoding>Plain</xsdLocal1:PayloadEncoding>
</xsdLocal1:Header>
<xsdLocal1:BucketBalance>
    <xsdLocal1:BucketCategory>VMRC_R2</xsdLocal1:BucketCategory>
    <xsdLocal1:BucketAmount>200.0</xsdLocal1:BucketAmount>
    <xsdLocal1:BucketLevel>Service</xsdLocal1:BucketLevel>
    <xsdLocal1:AllocationStartDate>03/25/2015 00:00:00</xsdLocal1:AllocationStartDate>
</xsdLocal1:BucketBalance>
<xsdLocal1:BucketBalance>
    <xsdLocal1:BucketCategory>VMRC_Rertet</xsdLocal1:BucketCategory>
    <xsdLocal1:BucketAmount>456.0</xsdLocal1:BucketAmount>
    <xsdLocal1:BucketLevel>sdfsdff</xsdLocal1:BucketLevel>
    <xsdLocal1:AllocationStartDate>03/25/2015 00:00:00</xsdLocal1:AllocationStartDate>
</xsdLocal1:BucketBalance>

0 个答案:

没有答案