我想将我的下面的xml分成两部分,每部分包含两个stream.Product的4包含,有没有什么办法使用xpath或xpath-node我可以实现这一点,我试过表达式:xml分成两半
/stream.PurchaseOrder/orderLine/products/stream.Product
它将产品分为四部分,any1能否帮助我用表达式或某种技术来达到要求?
<stream.PurchaseOrder>
<metaData>
<supplierId>1001</supplierId>
<supplier>Supplier1</supplier>
</metaData>
<orderLine>
<manufacturer>Manufacturer-1993628836</manufacturer>
<location>Location-1616142228</location>
<products>
<stream.Product>
<productId>852693979</productId>
<productName>ProductName-20</productName>
<price>100</price>
<model>Model413</model>
<quantity>50</quantity>
</stream.Product>
<stream.Product>
<productId>1111</productId>
<productName>ProductName11</productName>
<price>40</price>
<model>Model12</model>
<quantity>150</quantity>
</stream.Product>
<stream.Product>
<productId>85</productId>
<productName>ProductName3</productName>
<price>10</price>
<model>Model3</model>
<quantity>5</quantity>
</stream.Product>
<stream.Product>
<productId>11</productId>
<productName>ProductName4</productName>
<price>4</price>
<model>Model4</model>
<quantity>15</quantity>
</stream.Product>
</products>
</orderLine>
</stream.PurchaseOrder>
会是怎样的状况来选择stream.Product?还是总是减半? (所以如果你有8 stream.Product节点,你想要第一个4和最后4) – rene 2012-08-08 10:06:17
它会像我有12个产品,所以3批4产品,不是一半 – Rahul 2012-08-08 10:10:49
如果你有一半的东西会好起来但是之前的评论要求会更好。感谢:) – Rahul 2012-08-08 10:13:14