Ian MacRae
asked on
Modifying XML in visual studio
I have a fairly simple XML file that is generated by an application every 2 seconds.
I have another application that needs it in a different format
<root>
<dataset1>
<data>
<field id="0">data field 1 data</field>
<field id="1">data field 2 data</field>
</data>
</dataset1>
</root>
I have another application that needs it in a different format
<root>
<finaldataset>
<field_1>data field 1 data</field_1>
<field_2>data field 1 data</field_2>
</finaldataset>
</root>
Is there a simple way that I can use visual studio to modify the xml without literally reading line by line and pumping out the new format. This way is inefficient as there are over a thousand fields.
ASKER
Considered SSIS, but given the number of elements (could extend to several thousands) and the quick read / write turnaround requirements, this was a little too slow. The source file is being rewritten every 2 seconds (at least) so it needs to be read, processed and saved within that timeframe.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@LajuanTaylor
XML is from a proprietary (can't mention which one) monitoring sensor. Depending on state, the number of elements varies greatly. If it in a really bad error state the number of nodes exceeds 10,000. Normal is about 1,000.
Developers of source no longer available :(
My solution was similar to solution - used dedicated RAM to copy table, modified it and wrote out to SSD. Gets in just under 2 seconds.
Will mark your answer as accepted.
XML is from a proprietary (can't mention which one) monitoring sensor. Depending on state, the number of elements varies greatly. If it in a really bad error state the number of nodes exceeds 10,000. Normal is about 1,000.
Developers of source no longer available :(
My solution was similar to solution - used dedicated RAM to copy table, modified it and wrote out to SSD. Gets in just under 2 seconds.
Will mark your answer as accepted.
Is SSIS in Visual Studio an option that you can consider using?