Hi all -
I need some help trying to insert / append a block of xml text into an xml
document. This is for a reporting app and as new data is available, I must
add it to the end of the document. It should be simple but I cannot seem to
find the magic combo. Here is what I am trying to do:
The XML String is periodically generated and indicates the results of a
system test. The File is the Log File and is opened and a new XmlDocument is
created using the Log File FileStream. I want to insert / append the XML
string in the ResultsLog Tags. I have tried a number of variations but can't
seem to hit the right approach. The XML string is generated internally and
cannot be changed. Any suggestions are appreciated.
// Open the stream and read it back.
FileStream* fs = File::Open(sTestLogFile, FileMode::OpenOrCreate,
FileAccess::ReadWrite, FileShare::None);
XmlDocument* xmlReport = new XmlDocument;
xmlReport->Load(fs);
XML file:
<?xml version="1.0"?>
<ResultsLog>
</ResultsLog>
XML String:
<TestResults>
<Description>Unit number 2</Description>
<Tests>
<Test>
<Name type="string">REF to DUT Test</Name>
<Duration type="integer">40</Duration>
<Attenuation type="integer">70</Attenuation>
<Direction type="integer">0</Direction>
<MinRate type="integer">0</MinRate>
<MaxRate type="integer">200</MaxRate>
</Test>
<Test>
<Name type="string">REF to DUT Test</Name>
<Duration type="integer">40</Duration>
<Attenuation type="integer">71</Attenuation>
<Direction type="integer">0</Direction>
<MinRate type="integer">0</MinRate>
<MaxRate type="integer">200</MaxRate>
</Test>
<Test>
<Name type="string">REF to DUT Test</Name>
<Duration type="integer">40</Duration>
<Attenuation type="integer">72</Attenuation>
<Direction type="integer">0</Direction>
<MinRate type="integer">0</MinRate>
<MaxRate type="integer">200</MaxRate>
</Test>
</Tests>
</TestResults>