Automatically prepend the XML preprocessor directive if not present so we generate well-formed XML documents

This commit is contained in:
Michael Becker 2019-08-16 15:00:35 -04:00
parent df3309c087
commit 1f0e8845e8

View File

@ -940,6 +940,11 @@ namespace UniversalEditor.DataFormats.Markup.XML
WriteStartTag(mvarCompensateTopLevelTagName);
}
if (!(mom.Elements.Count > 0 && mom.Elements [0] is MarkupPreprocessorElement && (mom.Elements [0] as MarkupPreprocessorElement).FullName == "xml"))
{
tw.WriteLine ("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
}
foreach (MarkupElement element in mom.Elements)
{
WriteElement(element, 0);