0
我有这个XML,并希望拆分到个人XML文件基于<order>
标签计数保留从基地XML几个标签。因为我是新来玩xml和linq,我只是在谷歌搜索和堆栈溢出问题没有达到我的要求。分割成xml文件保留几个标签从基地xml文件使用LINQ
<OrderList>
<Source>xml</Source>
<Organisation>org</Organisation>
<CreationDate>12/14/2015</CreationDate>
<Orders>
<Order>
<Name> Mobile </Name>
<Price> 50.00</Price>
<Quantity> 1 </Quantity>
</Order>
<Order>
<Name> Accessories </Name>
<Price> 50.00</Price>
<Quantity> 5 </Quantity>
</Order>
</Orders>
</OrderList>
所以File1.xml应该
<OrderList>
<Source>xml</Source>
<Organisation>org</Organisation>
<CreationDate>12/14/2015</CreationDate>
<Orders>
<Order>
<Name> Mobile </Name>
<Price> 50.00</Price>
<Quantity> 1 </Quantity>
</Order>
</Orders>
</OrderList>
File2.xml
<OrderList>
<Source>xml</Source>
<Organisation>org</Organisation>
<CreationDate>12/14/2015</CreationDate>
<Orders>
<Order>
<Name> Accessories </Name>
<Price> 50.00</Price>
<Quantity> 5 </Quantity>
</Order>
</Orders>
</OrderList>
在计算器上的问题解释分裂标记插入XML文件,但我要保留从几个值base文件也可以。请任何帮助,这与Linq和XElement?
你能解释一下如何使用XPathselectElement吗?我试过,因为它有命名空间,但不保留从基本xml – curiousDev
几个标签,我建议你看看这个例子:https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110)。 aspx,然后试试这个http://www.webtoolkitonline.com/xml-xpath-tester.html –