0
任何人都可以請示範我如何通過使用Linq到XML讀取下面的外部節點;Linq到XML閱讀外在節點
<Root>
<ItemDetail>
<UnitPrice>
<Money currency="NZ">32</Money>
</UnitPrice>
<Description xml:lang="en">abc description</Description>
<UnitOfMeasure>CU</UnitOfMeasure>
<Classification domain="N/A"/>
<ManufacturerPartID>12345678</ManufacturerPartID>
<Extrinsic name="StockCode">23333</Extrinsic>
<Extrinsic name="Quantity">1</Extrinsic>
</ItemDetail>
<ItemDetail>
<UnitPrice>
<Money currency="NZ">32</Money>
</UnitPrice>
<Description xml:lang="en">abc description</Description>
<UnitOfMeasure>CU</UnitOfMeasure>
<Classification domain="N/A"/>
<ManufacturerPartID>12345678</ManufacturerPartID>
<Extrinsic name="StockCode">23333</Extrinsic>
<Extrinsic name="Quantity">1</Extrinsic>
</ItemDetail>
<ItemDetail>
<UnitPrice>
<Money currency="NZ">32</Money>
</UnitPrice>
<Description xml:lang="en">abc description</Description>
<UnitOfMeasure>CU</UnitOfMeasure>
<Classification domain="N/A"/>
<ManufacturerPartID>12345678</ManufacturerPartID>
<Extrinsic name="StockCode">23333</Extrinsic>
<Extrinsic name="Quantity">1</Extrinsic>
</ItemDetail>
</Root>
答案與你問的最後一個問題沒有多大差別(http://stackoverflow.com/questions/6167541/linq-to-xml-reading-xml-document)。嘗試適應。 – 2011-06-03 11:35:35
@Martin,如果您仔細閱讀,您提供的鏈接不會回答外部節點。我試過了,有沒有一種方法來讀取linq到XML中的名稱,因爲我的名字屬性都是一樣的? – 2011-06-03 11:37:51