I'm trying to read a particular XML, save the necessary information into two different classes Order
and OrderDetail
. However, when I try to read "BuyerID" from my XML with the following code, it throws me an InvalidOperationException
, with The ReadElementContentAsString method is not supported on node type None. Line 1, Position 634
: http://pastebin.com/Lu4mKtwq
At this particular line:
order.CustomerID = reader.ReadElementContentAsString();
My source code: http://pastebin.com/JyTz8x0G
This is the XML that I am working with:
<Orders>
<Order ID="O2">
<OrderDate>1/7/2016</OrderDate>
<BuyerID>WSC1810</BuyerID>
<OrderItem>
<Item ID="R1">
<ItemName>8GB RAM King</ItemName>
<Decscription>8GB RAM King</Decscription>
<Capacity>8GB</Capacity>
<Quantities>150</Quantities>
<existingUnitPrice>100.00</existingUnitPrice>
</Item>
<Item ID="R2">
<ItemName>4GB RAM King</ItemName>
<Decscription>4GB RAM King Brand</Decscription>
<Capacity>4GB</Capacity>
<Quantities>100</Quantities>
<existingUnitPrice>50.00</existingUnitPrice>
</Item>
</OrderItem>
<RemarksandSpecialInstruction>Fragile, handle with care</RemarksandSpecialInstruction>
</Order>
</Orders>