[mapguide-users] Fatal Parse error on SetResource

Peter Filip reklamama at centrum.sk
Tue Feb 24 06:14:15 EST 2009


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??





-- 
View this message in context: http://n2.nabble.com/Fatal-Parse-error-on-SetResource-tp2377337p2377337.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list