Search code examples
c#.netxmlmonomonodevelop

XmlException: Text node cannot appear in this state


I'm getting sometimes the error "Text node cannot appear in this state" in my application after editing a xml in MonoDevelop and loading it with dotNET. This error is really annoying, because i have to copy the XML-file to windows and try to fix it there with VS.

The xml file is absolutly correct, must be something with the encoding. Is there any quick way to fix this in MonoDevelop?

And of course, it would be interesting why this error appears.

Edit ( Short XML example on request )

<?xml version="1.0" encoding="UTF-8"?>
<Data>

</Data>

Solution

  • I found only one workaround for this error when using monodevelop only( There are other ways to solve this issue by using another editor ):

    Saving the file with another encoding ( UTF-16 ). This is not going to solve it permanently, if you edit the file again it may occur again.