Re: Problem appending a new element to xml file...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Glad to help - any problems, be sure to get back...

For completeness: your original code touched on XmlWriter; this is
typically used *instead of* the XmlDocument model in those scenarios
where XmlDocument is too heavy - just as very large xml fragments; with
XmlWriter you could write a 500Mb file from a database by writing one
row at a time directly to hte stream; with the XmlDocument you would
need to hold it all in memory first, probably taking about 4-times
that, so 2Gb (better hope for Win64 memory addressing!).
XmlDocument, however, uses the "all in memory" model to provide
services such as XPath/XQuery, and simple element manipulation. There
are other differences, but that is the general principle; for
small-to-mid-size xml, XmlDocument is a reasonable choice.

Marc

.



Relevant Pages

  • Re: XML-C#2.0 Dokument erzeugen - wie am besten?
    ... Der Unterschied zwischen XmlWriter und XmlDocument? ... Mit XmlWriter kann man XML erzeugen, direkt in eine Datei oder einen Stream oder einen String, dabei wird direkt XML-Markup erzeugt. ... XmlDocument hingegen ist ein Objektmodell, das es erlaubt, existierenden XML-Markup zu laden und in das Objektmodell zu parsen, dann das komplette Objektmodell zu manipulieren (Knoten aendern, Knoten hinzufuegen, Knoten loeschen, Knoten verschieben usw.), dann das Objektmodell zu speichern bzw. zu XML-Markup zu serialisieren. ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Using XMLDocument.Load with a memory stream...
    ... > Dim coreStream As New MemoryStream ... > Dim XmlWriter As New XmlTextWriter ... > Dim MyDocument as New XmlDocument ... > Dim TemporaryXmlDocument As New XmlDocument ...
    (microsoft.public.dotnet.framework)
  • Re: Using XMLDocument.Load with a memory stream...
    ... XmlDocument and reads through the file, ... >> Dim coreStream As New MemoryStream ... >> Dim XmlWriter As New XmlTextWriter ... >> in-memory Xml file and then copy that into an XmlDocument, ...
    (microsoft.public.dotnet.framework)
  • Re: Easiest way to build a xml fragment (write to string)
    ... For creating some XML fragment, you can use both XmlWriter or XMLDocument ... a string in memory instead of flush to file system. ...
    (microsoft.public.dotnet.general)
  • Re: Problem appending a new element to xml file...
    ... For example, even with PreserveWhiteSpace, a newline is ... You brought up a new issue to me: the xmlDocument vs XmlWriter. ... XmlElement newObservation = ...
    (microsoft.public.dotnet.languages.csharp)