Easy Question: Append to XML File

  • Thread starter Thread starter Jeff S
  • Start date Start date
J

Jeff S

I posted this in another group two days ago and surprisingly never got a
response:

How can I append new entries to an existing XML file?

Thanks.
 
Define "entries."

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Hi Kevin,

I don't know the correct word, but by 'entries', I mean elements (in my case
<LogEntry> elements... -as in the following XML sample). The big picture is
that I have an Exception logging routine that creates a more detailed
version of the following XML file. But rather than creating additional XML
files, I was wanting to have one file that gets additional <LogEntry>
elements when new exceptions are logged.

<?xml version="1.0"?>
<ExceptionLog>
<LogEntry>
<DateAndTime>
<Date>Friday, March 26, 2004</Date>
<Time>9:36:44 AM</Time>
</DateAndTime>
<SiteInfo>
<SiteID>18897</SiteID>
</SiteInfo>
<ServerInfo>
<MachineName>DUFUS-85</MachineName>
<OSPlatform>Win32NT</OSPlatform>
<OSVersion>5.1.2600.0</OSVersion>
<CLRVersion>1.1.4322.573</CLRVersion>
way mo stuff goes here
</ServerInfo>
<ExceptionInfo>
<ExceptionType>SqlException</ExceptionType>
lotsa mo stuff goes here - yaknowwhatI'msayin'
</ExceptionInfo>
</LogEntry>
</ExceptionLog>

Thanks!

Jeff
 
Remember that a valid XML file has just one root node. you need to add
entities of the type allowed by the schema
 
Back
Top