MapGuide only accepts utf-8 encoded data, with no BOM.
You must create an encoder for utf-8, and set the BOM generation to false.
With this encoder, you can get the bytes in the correct format.

Regards, Kenneth Skovhede, GEOGRAF A/S



Peter Filip skrev:
Hello,

i want to create a new layer and save it in the session repository.

I use this code:

        XmlDocument layerDefinition = new XmlDocument();
layerDefinition.Load(System.Web.HttpContext.Current.Server.MapPath(@"xml/Roads.xml"));

        Byte[] byteDef =
System.Text.Encoding.Default.GetBytes(layerDefinition.ToString());
        MgByteSource bs = new MgByteSource(byteDef, byteDef.Length);
        bs.SetMimeType(MgMimeType.Xml);

        MgResourceIdentifier layerId = new MgResourceIdentifier("Session:" +
mgSessionId + @"//cinnost." +  MgResourceType.LayerDefinition);

        resourceService.SetResource(layerId, bs.GetReader(), null);
        MgLayer layer = new MgLayer(layerId, resourceService);

Error show up on this line

resourceService.SetResource(layerId, bs.GetReader(), null);

And here is the error message

     An exception occurred in DB XML component.
        Error: XML Indexer: Fatal Parse error in document at line, 1, char
1. Parser message: Invalid document structure


The XML LayerDefinition should be OK. I used the one from Sheyboygan
package.
I have no idea where's the catch.. Any suggestions??





_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to