![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a DataTable with many rows. I use WriteXml to emit to an XmlWriter with an underlying StringWriter to put the final output into a string. I need to massage the XML output now. I don't know if it should be done while the data is in the DataTable, during the XmlWriter writing phase or after the information is in a string. I definitely don't want to put the whole thing into an XML DOM instance because the XML is currently 300mb in size. The data looks like this: item code>aaaa</code info>bbbb</info info2>cccc</info2 /item For every "info2" element, I need to add these two sub-elements (currently hardcoded): p:testbegin>2007-12-12T15:00:00</p:testbegin p:testend>2007-12-13T15:00:00</p:testend I would also like to add a custom namespace to the final XML document so instead of "code" I would like to have "p:code", and "p:info" instead of "info", but I do not want to change "info2". What is the best way to transform this from its DataTable origin? Thanks. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Hello coconet, It seems you need more control than what DataTable.WriteXml method provides. My suggestion is you may implement a custom WriterXML method by yourself. Thereby, we can apply logics and rules into XML file directly. Another idea is using XSL to transform the output from WirterXML method. Hope this helps. Please feel free to update here, if there is anything unclear. We are glad to assist you. Have a great day, Best regards, Wen Yuan Microsoft Online Community Support ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
|
I have a DataTable with many rows. I use WriteXml to emit to an XmlWriter with an underlying StringWriter to put the final output into a string. I need to massage the XML output now. I don't know if it should be done while the data is in the DataTable, during the XmlWriter writing phase or after the information is in a string. I definitely don't want to put the whole thing into an XML DOM instance because the XML is currently 300mb in size. The data looks like this: item code>aaaa</code info>bbbb</info info2>cccc</info2 /item For every "info2" element, I need to add these two sub-elements (currently hardcoded): p:testbegin>2007-12-12T15:00:00</p:testbegin p:testend>2007-12-13T15:00:00</p:testend I would also like to add a custom namespace to the final XML document so instead of "code" I would like to have "p:code", and "p:info" instead of "info", but I do not want to change "info2". What is the best way to transform this from its DataTable origin? Thanks. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |