order_h
すべてのorder_d
属性データを読み取りたい。しかし、私のプログラム コードでは、order_h タグ data.below を表示できます。ありがとう
<document>
<order>
<order_h owner="ABC" order_no="96431"/>
<order_d owner="ABC" order_no="96431" item_no="0153-8196-010">
<size assoc_id="1274847" size_id="B0153_0150XSXXLNIVINT_VAEC000076_BK"/>
</order_d>
<order_d owner="ABC" order_no="96431" item_no="0153-8196-020">
<size assoc_id="1274847" size_id="B0153_0150XSXXLNIVINT_VAEC000076_BK"/>
</order_d>
<order_h/>
</order>
<order>
<order_h owner="ABC" order_no="96432">
<order_d owner="ABC" order_no="96431" item_no="0153-8196-030">
<size assoc_id="1274847" size_id="B0153_0150XSXXLNIVINT_VAEC000076_BK"/>
</order_d>
<order_d owner="ABC" order_no="96431" item_no="0153-8196-040">
<size assoc_id="1274847" size_id="B0153_0150XSXXLNIVINT_VAEC000076_BK"/>
</order_d>
<order_h/>
</order>
</document>
XmlDocument doc = new XmlDocument();
doc.Load(@"File.xml");
XmlNode OrderListNode =
doc.SelectSingleNode("/document");
XmlNodeList OrderNodeList =
OrderListNode.SelectNodes("order/order_h");
foreach (XmlNode node in OrderNodeList)
{
Console.WriteLine(node.Attributes.GetNamedItem("owner").Value);
Console.WriteLine(node.Attributes.GetNamedItem("order_no").Value);
Console.WriteLine(node.Attributes.GetNamedItem("profoma_po").Value);
XmlNodeList OrderdNodeList = OrderListNode.SelectNodes("order_h/order_d");
foreach (XmlNode orderd in OrderdNodeList)
{
Console.WriteLine("D " + orderd.Attributes.GetNamedItem("owner").Value);
Console.WriteLine("D " + orderd.Attributes.GetNamedItem("order_no").Value);
Console.WriteLine("D " + orderd.Attributes.GetNamedItem("item_no").Value);
}
Console.WriteLine("*****************new Line*******************");
}