private XmlScript ConvertToXml(StringBuilder stringBuilder) { //Create Root XML XmlScript xmlScript = new XmlScript(); XmlElement rootElement = XmlScript.XmlRoot(xmlScript, RESOURCES); //Add StringBuilder Lines to XML XmlDocumentFragment fragment = xmlScript.CreateDocumentFragment(); fragment.InnerXml = stringBuilder.ToString(); rootElement.AppendChild(fragment); return xmlScript; }
private XmlScript ConvertToXml(StringBuilder stringBuilder) { //Create Root XML XmlScript xmlScript = new XmlScript(); Uri uri = new Uri("/WinResource.xml", UriKind.RelativeOrAbsolute); using (Stream stream = System.Windows.Application.GetResourceStream(uri).Stream) { xmlScript.Load(stream); } //Add StringBuilder Lines to XML XmlDocumentFragment fragment = xmlScript.CreateDocumentFragment(); fragment.InnerXml = stringBuilder.ToString(); xmlScript.DocumentElement.AppendChild(fragment); return xmlScript; }