Closed johannesvp closed 4 years ago
The XML string s are remove when posting the issue:
let xml = [ """<XtraSerializer version="1.0" application="DockLayoutManager">""" """ <property name="#LayoutVersion" isnull="true" />""" """ <property name="$DockLayoutManager" iskey="true" value="DockLayoutManager">""" """ <property name="DockingStyle">VS2010</property>""" """ <property name="FloatingMode">Desktop</property>""" """ </property>""" """</XtraSerializer>""" ]
Same for the Yaml document:
- "<XtraSerializer version=\"1.0\" application=\"DockLayoutManager\">"
- " <property name=\"#LayoutVersion\" isnull=\"true\" />"
- " <property name=\"$DockLayoutManager\" iskey=\"true\" value=\"DockLayoutManager\">"
- " <property name=\"DockingStyle\">VS2010</property>"
- " <property name=\"FloatingMode\">Desktop</property>"
- " </property>"
- "</XtraSerializer>"
...
There is an invisible character - chr(6) - after the first doublequote on the first line.
Compare this:
let goodYaml = "
- \"<XtraSerializer version=\\\"1.0\\\" application=\\\"DockLayoutManager\\\">\"
"
Deserialize<string list> goodYaml
With this:
let badYaml = "
- \"<XtraSerializer version=\\\"1.0\\\" application=\\\"DockLayoutManager\\\">\"
"
Deserialize<string list> badYaml
Funny thing is, with copy/paste from the web, the issue is included.
In Visual Studio, if you put the cursor between "
and <
and you navigate with the cursor keys left/right, you'll notice it is skipping a character. If you delete the invisible character, the full yaml will parse.
Anyhow, I'd check the source which is generating the Yaml.
That was the indeed the problem. Thank you very much for finding this.
Deserializing the XML strings works like a charm.
I am trying to deserialize a list of XML strings, but cannot succeed.
Step A I start of with XML strings like this: let xml = [ """"""
""" """
""" """
""" VS2010 """
""" Desktop """
""" """
""" """
]
Step B Then I serialize the strings using YamlDotNet, resulting in this YAML document:
I expect the original strings to be returned. But it returns an error on matching quotes. I also tried other options, like single quotes.