我想將我的下面的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