[mapguide-users] Modify mapdefinition in a layout

euskalmap ziburudebian at free.fr
Tue Mar 17 06:59:16 EDT 2009


Hi,
I have not send the good link of my file; in the previous version , i have
trying to delete in the xml the string
"xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd".
So, my file is :  http://patxi.mayol.free.fr/Untitled1.xml
http://patxi.mayol.free.fr/Untitled1.xml 

So i test GetResourceContent rather than SetResource : 
If i try  http://localhost/mapguide/mapagent/index.html
http://localhost/mapguide/mapagent/index.html  with GetResourceContent on
"Library://Ag Base/Mpg Urbanisme.WebLayout" and submit, i have this result : 

http://n2.nabble.com/file/n2490672/test.jpg 

The message in header, in french, is in english : This file XML does not
seem to have of information of style associated with him. The tree of the
document is shown below.

SO

Kenneth Skovhede, GEOGRAF A/S wrote:
> 
> A bit tricky, something to do with how .Net handles Xml I think.
> 
> The document is missing the attribute:
> xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd"
> 
> Which is required, because it is used for versioning and validation.
> If you take your document and open this page:
> http://localhost/mapguide/mapagent/index.html
> 
> Then click "Resource" -> "SetResource", point out the file,
> and in the "ResourceID" field type: "Library://mytest.WebLayout".
> 
> Then set the "Content" field to point to the file and click submit.
> You will see the error you mention.
> 
> Now add the above attribute, so the second line in the document becomes:
> <WebLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd">
> 
> Save the document, click back in the browser, and then "Submit" once more.
> This time it works. (Remember to check that the ResourceID and Content 
> field has not been reset).
> 
> Regards, Kenneth Skovhede, GEOGRAF A/S
> 
> 
> 
> euskalmap skrev:
>> Hi,
>> Yes, i have see the log file, but there is no more information that 'XML
>> Parser error'.
>> The logfile is :
>> http://n2.nabble.com/file/n2474100/logfile.jpg 
>>
>> About the XML file, after modification i have this file : 
>> http://patxi.mayol.free.fr/mytest.xml
>> http://patxi.mayol.free.fr/mytest.xml 
>>
>>
>>
>> Thanks
>> regards
>>
>>
>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>   
>>> Did you look in the error.log file?
>>> Could you try to save the xml document after modification, and send a 
>>> link to it?
>>>
>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>
>>>
>>>
>>> euskalmap skrev:
>>>     
>>>> Hi,
>>>> In fact, before modification, i have 
>>>> MgResourceIdentifier webLayoutId = new
>>>> MgResourceIdentifier(pst_weblayout) 
>>>> with pst_weblayout = "Library://Ag Base/MyLayout.WebLayout" 
>>>> I search the xml node for modify Mapdefinition resource and 
>>>> after modification i have in instruction 
>>>> webLayoutId = new MgResourceIdentifier(str_NewMapDefinition) 
>>>> with str_NewMapDefinition=Session:xxxxxxxxx//MyMap.MapDefinition
>>>> So, i set the resource and i have the message 'An exception occurred in
>>>> the
>>>> XML parser.'
>>>> I say it is simply to migrate vb to c#, but before i want to
>>>> understand.
>>>> I have use same sample who use this method on the forum; but i do not
>>>> explain where is my bug?
>>>> thanks a lot for your help
>>>>
>>>>
>>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>>   
>>>>       
>>>>> It is very trivial to convert the sample to C#... in fact I just did:
>>>>> http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout
>>>>>
>>>>> If you just want to understand what happens, there should be a more 
>>>>> verbose message in the error.log:
>>>>> C:\Program Files\MapGuideOpenSource2.0\Server\logs\error.log
>>>>>
>>>>> Also, are you certain that the pst_map is a valid map identifier, and 
>>>>> that str_NewMapDefinition is a valid resource identifier?
>>>>>
>>>>> I'm guessing that pst_map is a string like: 
>>>>> "Library://map.MapDefinition", so your str_NewMapDefinition becomes:
>>>>> Session:<sessionid>//Library://map.MapDefinition.MapDefinition
>>>>>
>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>>
>>>>>
>>>>>
>>>>> euskalmap skrev:
>>>>>     
>>>>>         
>>>>>> Hi,
>>>>>> It do not run with the parameter false in the instruction
>>>>>> UTF8Encoding
>>>>>> utf8
>>>>>> = new UTF8Encoding(false);
>>>>>> In your link sample(
>>>>>> http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout
>>>>>> http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout
>>>>>> ), it is a vb code with the mapguide maetro api; i will not change
>>>>>> all
>>>>>> my
>>>>>> code because i use c# with mapguide api; i want to undestand why it
>>>>>> do
>>>>>> not
>>>>>> run; i use the same method to change the filter in layers and it run
>>>>>> very
>>>>>> well ! what's append in my code?
>>>>>>
>>>>>> thanks
>>>>>>
>>>>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> You need to create the UTF8Encoding object with the parameter
>>>>>>> "false" 
>>>>>>> (meaning disable BOM).
>>>>>>>
>>>>>>> A slightly easier way to do this:
>>>>>>> http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout
>>>>>>>
>>>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> euskalmap skrev:
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>>> Hi
>>>>>>>> I provide the end user with a link to my special page (see the
>>>>>>>> code1).
>>>>>>>> In
>>>>>>>> that page i redirect to the MapGuide viewer files
>>>>>>>> (Response.Redirect).
>>>>>>>> code1:
>>>>>>>> http://n2.nabble.com/file/n2462320/sample1.jpg 
>>>>>>>> The fonction SetLayout Map modify the mapdefinition in my layout.
>>>>>>>> See
>>>>>>>> image
>>>>>>>> here :
>>>>>>>> http://n2.nabble.com/file/n2462320/sample2.jpg 
>>>>>>>> The problem : the layout is not modify and i have this message : An
>>>>>>>> exception occurred in the XML parser.
>>>>>>>> Have you an idea ?
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>               
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>
>>>>>
>>>>>     
>>>>>         
>>>>   
>>>>       
>>> _______________________________________________
>>> 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
> 
> 

-- 
View this message in context: http://n2.nabble.com/Modify-mapdefinition-in-a-layout-tp2462320p2490672.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list