Hello,

I have one problem with xml reading.

My xml file:

<TransactionDetail>
<SaleItem>
<ItemID>02900</ItemID>
<Discount Splitted="false" TypeCode="6000"> <-- New section
<LineNumber>7</LineNumber>
<Amount>0.36</Amount>
<DiscountableAmount>1.19</DiscountableAmount>
<DiscountName>RABATT</DiscountName>
<DerivationRuleID>99</DerivationRuleID>
<PromotionId>99</PromotionId>
</Discount>
</SaleItem>
</TransactionDetail>

How I can get "ItemID" when "Amount" > 0 ?

My code:

XmlReader textReader = XmlReader.Create(new StreamReader(@"C:\TEMP\Working\EJR\"+ejrName, Encoding.GetEncoding("ISO-8859-1")));

                    XmlDocument xmlDoc = new XmlDocument(); 
                    xmlDoc.Load(textReader);

                    XmlNodeList xnList = xmlDoc.SelectNodes("/TransactionDetail/SaleItem");
                    foreach (XmlNode xn in xnList)
                    {
                        string item = xn["ItemID"].InnerText;
                      
                    }

Thanks in advance:)

Read the Amount node value to a double and then do the foreach IF Amount > 0.00

Yes I know. But I have different level between Amount and ItemID. Can you write me a code how to do that ?

Have somebody any ideas ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.