Hi Folks,
I am trying to use GeoSerializer to serialize/deserialize a ZoomLevelSet. The serialization and deserialization processes goes perfectly as long as there`s no special characters on the style names… For example… I have this style:
…(file contents)
<
Element
inherit
=
“true”
type
=
“ThinkGeo.MapSuite.Core.ValueStyle, MapSuiteCore, Version=7.0.0.0, Culture=neutral, PublicKeyToken=0828af5241fb4207”
><!–</code–>
div
><
div
><
span
class
=
“Apple-tab-span”
style
=
“white-space:pre”
>
<
name
>Situação Florestal<!–</code–>
name
>
<
columnName
>FORESTSITUATIONDESCRIPTION<!–</code–>
columnName
>
<
valueItems
>
…(file contents)
<valueitems> When I deserialize I use this code:
GeoSerializer serializer = new GeoSerializer();
featureLayerToRestore.ZoomLevelSet = (ZoomLevelSet)serializer.Deserialize(layerElementFromLayout.Element(“ZoomLevelSet”).Value);
I am getting an XMLException: Invalid character in the given encoding. Line 47, position 20. (Where line 47 position 20 = ç)
The call stack:
System.Xml.dll!System.Xml.XmlTextReaderImpl.Throw(System.Exception e) + 0x46 bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.Throw(string res, string arg) + 0x75 bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.InvalidCharRecovery(ref int bytesCount = 6041, out int charsCount = 0) + 0xc6 bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.GetChars(int maxCharsCount) + 0x84 bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.ReadData() + 0xbd bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.ParseText(out int startPos = 0, out int endPos = 0, ref int outOrChars = 0) + 0x1ed bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.FinishPartialValue() + 0x3f bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.Value.get() + 0x4b bytes
> MapSuiteCore.dll!ThinkGeo.MapSuite.Core.XmlGeoSerializationFormatter.xhQ=(System.Xml.XmlReader 8hU= = {System.Xml.XmlReader.XmlReaderDebuggerDisplayProxy}) + 0x1b0 bytes
MapSuiteCore.dll!ThinkGeo.MapSuite.Core.XmlGeoSerializationFormatter.LoadCore(System.IO.Stream stream = {System.IO.MemoryStream}) + 0x5a bytes
Is there any way to set another encoding when using GEOSERIALIZER?
Just as information, when I am serializing, I am using this code:
XElement zoomLevelSetElement = new XElement(“ZoomLevelSet”);
GeoSerializer serializer = new GeoSerializer();
zoomLevelSetElement.Value = serializer.Serialize(featureLayer.ZoomLevelSet);
I get absolutelly no errors during serialization!
The full serialization XML is attached (ZoomLevelSet.xml)
Can anyone help me on that?
Kind regards,
Pedro
</valueitems>
002_001_ZoomLevelSet.xml (90.7 KB)