I'm converting some code that currently uses an XmlWriter
to create a document to instead return an XElement
of the content.
So far, I'm enjoying structuring the code in a way that mimics the structure of the document, but there is content that was written using XmlWriter.WriteRaw
to avoid re-xmlizing the xml. I can't find any equivalent in the System.Xml.Linq
namespace. Does one exist?
XElement.Parse()
should do the trick.
For example:
XElement e = new XElement("root",
new XElement("child",
XElement.Parse("<big><blob><of><xml></xml></of></blob></big>"),
new XElement("moreXml")));