I am using the following C# code to create a XML file:
private void CreateXML()
{
_logger.Log("Creating XML....");
XmlWriterSettings xmlWriterSettings = new XmlWriterSettings
{
Indent = true,
OmitXmlDeclaration = false,
Encoding = Encoding.UTF8,
CheckCharacters = true
};
XmlSerializer serializer = new XmlSerializer(typeof(List<Page>));
using (XmlWriter writer = XmlWriter.Create(_outputXMLFilePath, xmlWriterSettings))
{
serializer.Serialize(writer, this._pages);
}
_logger.Log("XML Created");
}
On line serializer.Serialize(writer, this._pages); I am getting the following exception:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll
Additional information: There was an error generating the XML document.
Can anyone please tell me what is the issue here?
No comments:
Post a Comment