[Mono-list] XmlWriter does not accept Text at Prolog

Snowl davviddiaz at gmail.com
Sat Feb 4 23:51:08 UTC 2012


I am trying to save an xml document, and I have been trying to get my code to
work but mono is spitting out a very strange error. I have given the file it
is trying to save to full ownership.

An example would be group.test.test to "Hello world!"

Here is the code:

http://pastebin.com/GLVnYneU http://pastebin.com/GLVnYneU 

Here is the error it gives me:

    Unhandled Exception: System.InvalidOperationException: This XmlWriter
does not accept Text at this state Prolog.
    at System.Xml.XmlTextWriter.ShiftStateContent (System.String occured,
Boolean allowAttribute) [0x00000] in <filename unknown>:0 
    at System.Xml.XmlTextWriter.WriteString (System.String text) [0x00000]
in <filename unknown>:0 
    at System.Xml.DefaultXmlWriter.WriteString (System.String text)
[0x00000] in <filename unknown>:0 
    at System.Xml.Linq.XText.WriteTo (System.Xml.XmlWriter w) [0x00000] in
<filename unknown>:0 
    at System.Xml.Linq.XDocument.WriteTo (System.Xml.XmlWriter w) [0x00000]
in <filename unknown>:0 
    at System.Xml.Linq.XDocument.Save (System.Xml.XmlWriter w) [0x00000] in
<filename unknown>:0 
    at System.Xml.Linq.XDocument.Save (System.String filename, SaveOptions
options) [0x00000] in <filename unknown>:0 
    at System.Xml.Linq.XDocument.Save (System.String filename) [0x00000] in
<filename unknown>:0 
    at Classic6.XmlSettings.set_Item (System.String key, System.String
value) [0x00000] in <filename unknown>:0 
    at Classic6.CmdSettings.Use (Classic6.RemoteClient c, System.String
message) [0x00000] in <filename unknown>:0 
    at Classic6.ClassicServer.HandleCommand (Classic6.RemoteClient c,
System.String msg) [0x00000] in <filename unknown>:0 
    at Classic6Server.Program.ParseInput (System.String input) [0x00000] in
<filename unknown>:0 
    at Classic6Server.Program.Main () [0x00000] in <filename unknown>:0 
    [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException:
This XmlWriter does not accept Text at this state Prolog.
    at System.Xml.XmlTextWriter.ShiftStateContent (System.String occured,
Boolean allowAttribute) [0x00000] in <filename unknown>:0 
    at System.Xml.XmlTextWriter.WriteString (System.String text) [0x00000]
in <filename unknown>:0 
    at System.Xml.DefaultXmlWriter.WriteString (System.String text)
[0x00000] in <filename unknown>:0 
    at System.Xml.Linq.XText.WriteTo (System.Xml.XmlWriter w) [0x00000] in
<filename unknown>:0 
    at System.Xml.Linq.XDocument.WriteTo (System.Xml.XmlWriter w) [0x00000]
in <filename unknown>:0 
    at System.Xml.Linq.XDocument.Save (System.Xml.XmlWriter w) [0x00000] in
<filename unknown>:0 
    at System.Xml.Linq.XDocument.Save (System.String filename, SaveOptions
options) [0x00000] in <filename unknown>:0 
    at System.Xml.Linq.XDocument.Save (System.String filename) [0x00000] in
<filename unknown>:0 
    at Classic6.XmlSettings.set_Item (System.String key, System.String
value) [0x00000] in <filename unknown>:0 
    at Classic6.CmdSettings.Use (Classic6.RemoteClient c, System.String
message) [0x00000] in <filename unknown>:0 
    at Classic6.ClassicServer.HandleCommand (Classic6.RemoteClient c,
System.String msg) [0x00000] in <filename unknown>:0 
    at Classic6Server.Program.ParseInput (System.String input) [0x00000] in
<filename unknown>:0 
    at Classic6Server.Program.Main () [0x00000] in <filename unknown>:0

and in the xml file it overwrites it completely and only leaves this:

    <?xml version="1.0" encoding="utf-8"?>

which is a lot different from this:

    <?xml version="1.0" encoding="utf-8" ?>
    <Classic6>
      <group>
       <test>Will I change</test>
       <well>I hope so</well>
      </group>
    </Classic6>

The code works 100% on windows, and I tried upgrading to 2.10.1 and that
didn't work so i compiled the latest source... that still didn't work...
help!

--
View this message in context: http://mono.1490590.n4.nabble.com/XmlWriter-does-not-accept-Text-at-Prolog-tp4358178p4358178.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list