G
gregarican
I have written a C# 2005 program that pulls the results on an SQL
query into an XML output file. The XML elements represent either a
retail sales or retail refund transaction. My dilemma is I need to
remove any offsetting nodes. For example, a sale and a refund for the
same stock item should cancel themselves out. Or a sale, refund, and
another sale for the same stock item should only appear as a single
sale.
A sample snippet of the XML would look similar to this
<transaction>
<documentNumber>SALE1</documentNumber>
<stockNumber>1234</stockNumber>
</transaction>
<transaction>
<documentNumber>SALE2</documentNumber>
<stockNumber>1234</stockNumber>
</transaction>
<transaction>
<documentNumber>REFUND1</documentNumber>
<stockNumber>1234</stockNumber>
</transaction>
What I'd need to do is somehow parse through the XML nodes
(XMLNodeList.SelectNodes I'm thinking?) and remove the offsetting
nodes containing SALE1 and REFUND1 so that only the SALE2 node would
remain. Any suggestions about the easiest way to accomplish this? I
can't readily utilize LINQ because of .NET 2.0 dependencies...
query into an XML output file. The XML elements represent either a
retail sales or retail refund transaction. My dilemma is I need to
remove any offsetting nodes. For example, a sale and a refund for the
same stock item should cancel themselves out. Or a sale, refund, and
another sale for the same stock item should only appear as a single
sale.
A sample snippet of the XML would look similar to this
<transaction>
<documentNumber>SALE1</documentNumber>
<stockNumber>1234</stockNumber>
</transaction>
<transaction>
<documentNumber>SALE2</documentNumber>
<stockNumber>1234</stockNumber>
</transaction>
<transaction>
<documentNumber>REFUND1</documentNumber>
<stockNumber>1234</stockNumber>
</transaction>
What I'd need to do is somehow parse through the XML nodes
(XMLNodeList.SelectNodes I'm thinking?) and remove the offsetting
nodes containing SALE1 and REFUND1 so that only the SALE2 node would
remain. Any suggestions about the easiest way to accomplish this? I
can't readily utilize LINQ because of .NET 2.0 dependencies...