Xml xpath samples

Xml:

<?xml version="1.0" encoding="utf-8" ?>
<Orders xmlns="http://www.xml.com">
  <Order Id="1" Supplier="Company A" Type="Purchase">
    <OrderItems catalog="A">
      <Item>1<Item>
      <Item>2</Item>
      <Item>3</Item>
    </OrderItems>
    <OrderItems catalog="B">
      <Item>1<Item>
      <Item>2</Item>
      <Item>3</Item>
    </OrderItems>
  </Order>
<Order Id="2" Customer="Company B" Type="Sales">
    <OrderItems>
      <Item>2</Item>
    </OrderItems>
  </Order>
</Orders>

Case1:

/Orders/Order[@Id="1"]

/Orders/Order[@Id="1"]/OrderItems[contains(Item,"1") and contains(@catalog,"A")]

update........

 

posted @ 2013-07-18 10:28  Leo Tang  阅读(219)  评论(0编辑  收藏  举报