[mapguide-users] Legend and runtime Layer filter

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Sun Apr 19 09:50:50 EDT 2009


And you have not added the ? when saving?

A guess would be that the Xml has the UTF-8 BOM when you are saving it,
and the loading code does not accept it, and inserts a placeholder for a 
non-printable char.

When you have the string in .Net and want to get the bytes, try to do this:
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(false, 
true);
byte[] bytes = encoder.GetBytes(layerDefXml);
Then pass the bytes when saving the layerdefinition.

I have created a special Xml serializer class to deal with this in the 
MaestroAPI:
http://svn.osgeo.org/mapguide/trunk/Tools/Maestro/MaestroAPI/Utf8XmlWriter.cs

Regards, Kenneth Skovhede, GEOGRAF A/S



Matteo skrev:
> Yes, the code add a "?" char before the "<?xml version="1.0" encoding="UTF-8"?>" line.
> Regards,
> Matteo
> 
>
>
> That would suggest that the data in the resource is invalid xml?
> Have you tried to examine the layerDefString variable before the crash?
>
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
>
>
> Matteo skrev:
>   
>> Hi Kenneth,
>>   I have found the bug. The problem is on BuildLayerDefinitionData sub of Legend.aspx file. When the sub process a runtime layer the line doc.LoadXml(layerDefString) get a error. I solve the problem saving the xml definition of layer in a file and load it
>>
>> The same problem there is in MapGuide Enterprise 2010 so I think also in MapGuide Open Source 2.1
>>
>> Regards
>> Matteo
>>
>>
>> Have you tried with a subset of the filter? eg: only: callStatus like 
>> 'Completed'.
>> I have had trouble with composite filters on OGR datasources, but single 
>> filters work fine.
>> The "valid = 01" part looks a little suspicious to me, is "valid" a 
>> numeric or text column?
>>
>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>
>>
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>>
>>
>>   
>>     
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090419/2742fffd/attachment.html


More information about the mapguide-users mailing list