Writing XML in C# - 'Token StartElement in state Epilog would result in an invalid XML document' error -
I am trying to write an XML document, taking data from an ArrayList of lists
< For pre (int i = 0; i The problem is that after going through the loop for one time, I get a token start element in the state epilogue, resulting in an illegal XML document 'line with WriteStartElement But error, and I have tried to fix it and there really is no success. Thank you.
Edited for updates.
Your problem is here:
textWriter.WriteStartElement ("metadata Name", ""); An element name can not contain spaces. Try it:
textWriter.WriteStartElement ("MetadataName", ""); I assume that the data in your header is well-formed for XML (for example, all & amp; ; & amp; amp; etc are escaped ...). Additionally, in your reply as Mark Notes, you need to make sure that the XML root is - which is a basic element in which you have your own MetadataName element has put.
And what it means - you need to make sure that your document is well made, as you make it up
Comments
Post a Comment