OK. I see your point. Let me go over the technical aspect. There is a sale system. There are about several hundreds of transactions in a day. The data is stored in a database. For each transaction, there is transaction header (usual stuff like customer id, transaction id, number of SKU involved, etc). There is also transaction detail (like item id, quantity of this item customer wants, etc). As you may see it, header to detail is a 1 to many relationship. One item we have to produce is an executable. This program will be run at end of each business day to output all transaction data to one XML file. This XML file is 3 level deep. It is similar to this:
<SalesRecord>
<VBAK SalesID="00001">
<AUART>SELL</AUART>
<SPART>GO</SPART>
<KUNNR>0000752134</KUNNR>
<BOTNK>2012071211085671S</BOTNK>
<VDATU>20120711</VDATU>
<VBAP item="10">
<MATNR>700911581</MATNR>
<KWMENG>3</KWMENG>
<UVKME>UC<UVKME>
</VBAP>
<VBAP item="20">
<MATNR>700912313</MATNR>
<KWMENG>4</KWMENG>
<UVKME>UC<UVKME>
</VBAP>
</VBAK>
<VBAK SalesID="00002">
...
</VBAK>
</SalesRecord>
It looks simple at first. Without much experience in processing this kind of XML, I think we could just let the program to write the XML out using something like XMLWriter(). This basically output a database table to XML format. Well in the database, the header and detail of each transaction are stored in two different tables! Somehow the person suppose to help me out use another way. He write a stored procedure to output 3 tables. In the program, he use DataAdapter to hold 3 tables (da.TableMappings.Add()). He then set mapping type of certain DataColumn (to be MappingType.Attribute or Mapping.Hidden). Afterward, use XMLDocument.LoadXML() to write out the XML file. Well there you have it.