<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Book Antiqua";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Book Antiqua";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Book Antiqua";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Thanks Kenneth I used the
MaestroAPI. Now I am able to change my layer at run time in the map.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>But I want to confirm
whether the same API&#8217;s work with fusion? Because I will be making fusion
application finally.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><b><font size=2 color=gray face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:gray;font-weight:bold'>Regards,<o:p></o:p></span></font></b></p>

<p class=MsoNormal><font size=2 color=gray face="Times New Roman"><span
style='font-size:11.0pt;color:gray'>Ravinder <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 color="#c41230" face="Book Antiqua"><span
style='font-size:9.0pt;font-family:"Book Antiqua";color:#C41230'>&nbsp;</span></font><font
size=1 color="#c41230" face="Book Antiqua"><span style='font-size:9.0pt;
font-family:"Book Antiqua";color:#C41230'><o:p></o:p></span></font></p>

</div>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Kenneth Skovhede, GEOGRAF A/S<br>
<b><span style='font-weight:bold'>Sent:</span></b> Saturday, February 14, 2009
5:21 PM<br>
<b><span style='font-weight:bold'>To:</span></b> MapGuide Users Mail List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [mapguide-users]
Regarding Linking of Layers with Map at run time</span></font><font
color=black><span style='color:windowtext'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>I can't guess what you are trying to achieve with the
code.<br>
MaestroAPI is not the only way, you can use the native API like you do, <br>
but you have to handle all the quirks yourself, which is not a trivial task.<br>
<br>
This line is not valid C#:<br>
</span></font><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier webLayoutId = new MgResourceIdentifier(&quot;Library://
Samples/ <st1:City u1:st="on"><st1:place u1:st="on"><st1:City w:st="on"><st1:place
 w:st="on">Sheboygan</st1:place></st1:City></st1:place></st1:City>
/Layouts\BasicLayout.WebLayout&quot;);<br>
<br>
\B is not a valid string escape sequence, and there seems to be some spaces,
which may come from the mail program.<br>
</span></font><br>
<font size=2 face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>I
think you can get a better understanding of the MaestroAPI from these two
examples:<br>
<a
href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/AddInitialLayer">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/AddInitialLayer</a><br>
<a
href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout</a></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><br>
<br>
This piece of code seems to ovewrite the runtime map, with the <st1:City w:st="on"><st1:place
 w:st="on">Sheboygan</st1:place></st1:City>:</span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MgMap map = new
MgMap();<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MgResourceIdentifier
resId = new<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier(&quot;Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition&quot;);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String mapName =
resId.GetName();<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.Create(resourceSrvc,
resId, mapName);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MgResourceIdentifier
mapStateId = new MgResourceIdentifier(&quot;Session:&quot; + sessionId +
&quot;//&quot; + mapName + &quot;.&quot; + MgResourceType.Map);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
map.Save(resourceSrvc, mapStateId);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><br>
This code seems to set the startup map in the library weblayout to the <st1:City
w:st="on"><st1:place w:st="on">sheboygan</st1:place></st1:City> map:<o:p></o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MgResourceIdentifier
webLayoutId = new MgResourceIdentifier(&quot;Library:// Samples/ <st1:City u1:st="on"><st1:place u1:st="on"><st1:City
w:st="on"><st1:place w:st="on">Sheboygan</st1:place></st1:City></st1:place></st1:City>
/Layouts\BasicLayout.WebLayout&quot;);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MgByteReader
byteReader = resourceSrvc.GetResourceContent(webLayoutId);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlDocument doc = new
XmlDocument();<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String xmlLayoutDef =
byteReader.ToString();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
doc.LoadXml(xmlLayoutDef);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlNode parentNode =
doc.GetElementsByTagName(&quot;ResourceId&quot;).Item(0);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (parentNode !=
null)<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XmlNode mapRessource =
doc.SelectSingleNode(&quot;/WebLayout/Map/ResourceId&quot;);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (mapRessource != null)<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mapRessource.InnerText = &quot;Library://Samples/Sheboygan/&quot; +
&quot;Maps/Sheboygan&quot; +
&quot;.MapDefinition&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String string1= doc.DocumentElement.OuterXml;<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
resourceSrvc.SetResource(webLayoutId, new MgByteReader(string1,
&quot;text/xml&quot;),
null);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><o:p></o:p></p>

<u2:p></u2:p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u2:p></u2:p><br>
</span></font><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>You cannot overwrite the runtime map, because the <st1:City
w:st="on"><st1:place w:st="on">AJAX</st1:place></st1:City> viewer always
overwrites the<br>
runtime map at startup, so the first segment of code has no effect.<br>
The last part seems correct, but the exception states that the xml is broken in
some way.<br>
I have seen others complain about the same problem, but I don't know what
happens.<br>
It seems that the SetResource or MgByteReader breaks the data in some way.<br>
<br>
<br>
</span></font><br>
<br>
<o:p></o:p></p>

<pre><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>Regards, Kenneth Skovhede, GEOGRAF A/S<o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><br>
<br>
<a href="mailto:ravinder.singh@BIRLASOFT.COM">ravinder.singh@BIRLASOFT.COM</a>
skrev: <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u2:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"><u2:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><!--[if gte mso 9]><xml>
   <u2:shapedefaults u3:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
   <u2:shapelayout u4:ext="edit">
    <u2:idmap u4:ext="edit" data="1"/>
   </u2:shapelayout>
</xml><![endif]--></u2:SmartTagType></u2:SmartTagType>I have written the
following code also, it uses xml and infact when this code runs it runs
perfectally without any problem, it does what I wanted to do, it changes the
map definition &nbsp;in web layout, and it runs perfectally if I run from
maestro, &nbsp;but when I try to run from my .net page<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&lt;frame
id=&quot;viewerFrame&quot; frameborder=&quot;no&quot; marginwidth=&quot;0&quot;
marginheight=&quot;0&quot; scrolling=&quot;no&quot;
src=&quot;../mapviewernet/ajaxviewer.aspx?SESSION=<span style='-moz-background-clip: -moz-initial;
-moz-background-origin: -moz-initial;-moz-background-inline-policy: -moz-initial;
background-attachment:scroll;background-position-x:0%;background-position-y:
50%'><span style='background:yellow'>&lt;%</span></span>=sessionId<span
style='-moz-background-clip: -moz-initial;-moz-background-origin: -moz-initial;
-moz-background-inline-policy: -moz-initial;background-attachment:scroll;
background-position-x:0%;background-position-y:50%'><span style='background:
yellow'>%&gt;</span></span>&amp;WEBLAYOUT=<span style='-moz-background-clip: -moz-initial;
-moz-background-origin: -moz-initial;-moz-background-inline-policy: -moz-initial;
background-attachment:scroll;background-position-x:0%;background-position-y:
50%'><span style='background:yellow'>&lt;%</span></span>=webLayout<span
style='-moz-background-clip: -moz-initial;-moz-background-origin: -moz-initial;
-moz-background-inline-policy: -moz-initial;background-attachment:scroll;
background-position-x:0%;background-position-y:50%'><span style='background:
yellow'>%&gt;</span></span>&quot;&gt;<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Then the problem comes. And
it says the following error. <u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Type
'OSGeo.MapGuide.MgNullArgumentException' in Assembly 'MapGuideDotNetApi,
Version=2.0.0.2716, Culture=neutral, PublicKeyToken=null' is not marked as
serializable.<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>If I save the map once in
maestro then the viewer also runs. I have also tried to read the header of xml
and passing in resourceSrvc.SetResource as third parameter, the problem remains
the same.<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>So I just want to confirm
whether maestro API you suggested would be the final and last way to do this
thing, or some other way ? Because I am not aware of using maestro api.<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>//Here
is my code<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>MgUserInformation
userInfo_new = new MgUserInformation(sessionId);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgSiteConnection siteConnection = new MgSiteConnection();<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
siteConnection.Open(userInfo_new);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceService resourceSrvc =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgMap map = new MgMap();<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier resId = new<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier(&quot;Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition&quot;);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String mapName = resId.GetName();<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
map.Create(resourceSrvc, resId, mapName);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier mapStateId = new MgResourceIdentifier(&quot;Session:&quot;
+ sessionId + &quot;//&quot; + mapName + &quot;.&quot; + MgResourceType.Map);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
map.Save(resourceSrvc, mapStateId);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier webLayoutId = new MgResourceIdentifier(&quot;Library://
Samples/ <st1:City u1:st="on"><st1:place u1:st="on"><st1:City w:st="on"><st1:place
 w:st="on">Sheboygan</st1:place></st1:City></st1:place></st1:City>
/Layouts\BasicLayout.WebLayout&quot;);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgByteReader byteReader =
resourceSrvc.GetResourceContent(webLayoutId);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XmlDocument doc = new XmlDocument();<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String xmlLayoutDef =
byteReader.ToString();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
doc.LoadXml(xmlLayoutDef);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XmlNode parentNode = doc.GetElementsByTagName(&quot;ResourceId&quot;).Item(0);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (parentNode != null)<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XmlNode mapRessource =
doc.SelectSingleNode(&quot;/WebLayout/Map/ResourceId&quot;);<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (mapRessource != null)<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mapRessource.InnerText = &quot;Library://Samples/Sheboygan/&quot; +
&quot;Maps/Sheboygan&quot; +
&quot;.MapDefinition&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String string1= doc.DocumentElement.OuterXml;<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
resourceSrvc.SetResource(webLayoutId, new MgByteReader(string1,
&quot;text/xml&quot;),
null);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<u2:p></u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><o:p></o:p></p>

<u2:p></u2:p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u2:p>&nbsp;</u2:p></span></font><o:p></o:p></p>

<div>

<p class=MsoNormal><b><font size=2 color=gray face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:gray;font-weight:bold'>Regards,<u2:p></u2:p></span></font></b><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=gray face="Times New Roman"><span
style='font-size:11.0pt;color:gray'>Ravinder <u2:p></u2:p></span></font><o:p></o:p></p>

</div>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> <a href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>
[<a href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Kenneth Skovhede,
GEOGRAF A/S<br>
<b><span style='font-weight:bold'>Sent:</span></b> Saturday, February 14, 2009 4:33
PM<br>
<b><span style='font-weight:bold'>To:</span></b> MapGuide Users Mail List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [mapguide-users]
Regarding Linking of Layers with Map at run time</span></font><o:p></o:p></p>

</div>

<u2:p></u2:p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u2:p>&nbsp;</u2:p><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>The MgMap class represents a runtime map, not a
MapDefinition.<br>
There is no such class a a MgMapDefinition, so you have to read/write the xml.<br>
If you wish to use the standard viewer, you have to do this.<br>
I was very annoyed by this, so I created the MaestroAPI that has classes for
all the Xml documents,<br>
including the MapDefinition:<br>
<a href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI"
moz-do-not-send=true>http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI</a><br>
<br>
If you start the viewer with an empty map, you can access the MgMap object,<br>
and add layers as runtime layers, using the MgMap.Layers.Add method.<br>
<br>
<br>
<br>
<o:p></o:p></span></font></p>

<u2:p></u2:p><pre><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>Regards, Kenneth Skovhede, GEOGRAF A/S<u2:p></u2:p><o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><br>
<br>
<a href="mailto:ravinder.singh@BIRLASOFT.COM" moz-do-not-send=true>ravinder.singh@BIRLASOFT.COM</a>
skrev: <u2:p></u2:p><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u5:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"><u5:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><u5:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"><!--[if gte mso 9]><xml>
    <u5:shapedefaults u6:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
    <u5:shapelayout u3:ext="edit">
     <u5:idmap u3:ext="edit" data="1"/>
    </u5:shapelayout>
</xml><![endif]--></u5:SmartTagType></u5:SmartTagType></u5:SmartTagType>Hi
Stefan,<u5:p></u5:p></span></font><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u5:p>&nbsp;</u5:p></span></font><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'>I put the way
you said but it gives the following error now.<u5:p></u5:p></span></font><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u5:p>&nbsp;</u5:p></span></font><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'>Type
'OSGeo.MapGuide.MgXmlParserException' in Assembly 'MapGuideDotNetApi,
Version=2.0.0.2716, Culture=neutral, PublicKeyToken=null' is not marked as
serializable.<u5:p></u5:p></span></font><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u5:p>&nbsp;</u5:p></span></font><u2:p></u2:p><o:p></o:p></p>

<div>

<p class=MsoNormal><b><font size=2 color=gray face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:gray;font-weight:bold'>Regards,<u5:p></u5:p></span></font></b><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><st1:PersonName u4:st="on"><font size=2 color=gray
face="Times New Roman"><span style='font-size:11.0pt;color:gray'>Ravinder Singh</span></font></st1:PersonName><u2:p></u2:p><o:p></o:p></p>

</div>

<u5:p></u5:p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> <a href="mailto:mapguide-users-bounces@lists.osgeo.org"
moz-do-not-send=true>mapguide-users-bounces@lists.osgeo.org</a> [<a
href="mailto:mapguide-users-bounces@lists.osgeo.org" moz-do-not-send=true>mailto:mapguide-users-bounces@lists.osgeo.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Stefan Dalakov<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, February 13, 2009
11:10 PM<br>
<b><span style='font-weight:bold'>To:</span></b> MapGuide Users Mail List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [mapguide-users]
Regarding Linking of Layers with Map at run time</span></font><u2:p></u2:p><o:p></o:p></p>

</div>

<u5:p></u5:p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u5:p>&nbsp;</u5:p><u2:p></u2:p><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>Try <br>
</span></font><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>MgResourceIdentifier mapName = new
MgResourceIdentifier(&quot;Session:&quot; + sessionId +
&quot;//Sheboygan.MapDefinition&quot;);<br>
<br>
<br>
Stefan Dalakov<br>
<br>
</span></font><a href="mailto:ravinder.singh@BIRLASOFT.COM"
moz-do-not-send=true>ravinder.singh@BIRLASOFT.COM</a> wrote: <u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u7:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"><u7:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><u7:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"><!--[if gte mso 9]><xml>
    <u7:shapedefaults u8:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
    <u7:shapelayout u3:ext="edit">
     <u7:idmap u3:ext="edit" data="1"/>
    </u7:shapelayout>
</xml><![endif]--></u7:SmartTagType></u7:SmartTagType></u7:SmartTagType>Hi All,<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>I have created the map definition
in maestro and also created a web layout, and I have hundreds of Maps, and each
map will have a single layer, but I don&#8217;t want to create the hundreds of
maps for each single layer. For that purpose I though I will just make a single
map and will associate the layer at run time to that map. So I wrote the
following set of code for <st1:City u6:st="on"><st1:place u6:st="on"><st1:City u4:st="on"><st1:place u4:st="on"><st1:City u1:st="on"><st1:place u1:st="on"><st1:City
w:st="on"><st1:place w:st="on">Sheboygan</st1:place></st1:City></st1:place></st1:City></st1:place></st1:City></st1:place></st1:City>
sample<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>But when I reach to
map.Save(resourceSrvc, mapName) <u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>it gives me the error <u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>MgXmlParserException
{&quot;An exception occurred in the XML parser.&quot;}<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>And also I tried with
Map.Open and then the following error comes<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Resource was not found:
Session:b275c3b6-ffff-ffff-8000-001a4bb4a756_en_7F0000010AFC0AFB0AFA//Samples/Sheboygan/Sheboygan.MapDefinition<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>I
have written the following code<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>MgUserInformation
userInfo = new MgUserInformation(defaultUser, defaultPassword);<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgSite site = new MgSite();<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
site.Open(userInfo);<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
sessionId = site.CreateSession();<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>MgUserInformation
userInfo_new = new MgUserInformation(sessionId);<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgSiteConnection siteConnection = new MgSiteConnection();<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
siteConnection.Open(userInfo_new);<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>MgResourceService
resourceSrvc =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>MgResourceIdentifier mapName
= new MgResourceIdentifier(&quot;Session:&quot; + sessionId +
&quot;//Samples/Sheboygan/Sheboygan.MapDefinition&quot;);<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgMap map = new MgMap();<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;map.Open(resourceSrvc, mapName); // Here the problem comes<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
map.Save(resourceSrvc, mapName); // Here the problem comes</span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<u7:p></u7:p>

<p class=MsoNormal><font size=2 color=black face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>I am using .net aspx with
map guide 2.0<u7:p></u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua"'><u7:p>&nbsp;</u7:p></span></font><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><b><font size=2 color=gray face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:gray;font-weight:bold'>Thanks
&amp; Regards,<u7:p></u7:p></span></font></b><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<p class=MsoNormal><st1:PersonName u6:st="on"><font size=2 color=gray
face="Times New Roman"><span style='font-size:11.0pt;color:gray'>Ravinder Singh</span></font></st1:PersonName><u5:p></u5:p><u2:p></u2:p><o:p></o:p></p>

<u7:p></u7:p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u7:p>&nbsp;</u7:p><u5:p></u5:p><u2:p></u2:p><o:p></o:p></span></font></p>

<table class=MsoNormalTable border=0 cellpadding=0>
 <tr>
  <td bgcolor=white style='background:white;padding:.75pt .75pt .75pt .75pt;
  -moz-background-clip: -moz-initial;-moz-background-origin: -moz-initial;
  -moz-background-inline-policy: -moz-initial;background-attachment:scroll;
  background-position-x:0%;background-position-y:50%'>
  <p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
  style='font-size:12.0pt'>*********************************************************************************************************************************************************************<br>
  &quot;This message and any attachments are solely for the intended recipient
  and may contain Birlasoft confidential or privileged information. If you are
  not the intended recipient,any disclosure,copying, use, or distribution of
  the information included in this message and any attachments is <br>
  prohibited. If you have received this communication in error, please notify
  us by reply e-mail at (<a href="mailto:administrator@birlasoft.com"
  moz-do-not-send=true>administrator@birlasoft.com</a>) and permanently delete
  this message and any attachments. Thank you.&quot;<br>
  *********************************************************************************************************************************************************************<u5:p></u5:p><u2:p></u2:p><o:p></o:p></span></font></p>
  </td>
 </tr>
</table>

<pre wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><u5:p>&nbsp;</u5:p><u2:p></u2:p><o:p></o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><u2:p>&nbsp;</u2:p><o:p></o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><u2:p>&nbsp;</u2:p><o:p></o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>

<hr size=4 width="90%" align=center>

</span></font></pre><pre style='text-align:center'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><u2:p>&nbsp;</u2:p><o:p></o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><u2:p>&nbsp;</u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><u5:p>&nbsp;</u5:p><u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>_______________________________________________<u5:p></u5:p><u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>mapguide-users mailing list<u5:p></u5:p><u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="mailto:mapguide-users@lists.osgeo.org" moz-do-not-send=true>mapguide-users@lists.osgeo.org</a><u5:p></u5:p><u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="http://lists.osgeo.org/mailman/listinfo/mapguide-users"
moz-do-not-send=true>http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><u5:p></u5:p><u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>&nbsp; <u5:p></u5:p><u2:p></u2:p><o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u5:p>&nbsp;</u5:p><u2:p></u2:p><o:p></o:p></span></font></p>

<table class=MsoNormalTable border=0 cellpadding=0>
 <tr>
  <td bgcolor=white style='background:white;padding:.75pt .75pt .75pt .75pt;
  -moz-background-clip: -moz-initial;-moz-background-origin: -moz-initial;
  -moz-background-inline-policy: -moz-initial;background-attachment:scroll;
  background-position-x:0%;background-position-y:50%'>
  <p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
  style='font-size:12.0pt'>*********************************************************************************************************************************************************************<br>
  &quot;This message and any attachments are solely for the intended recipient
  and may contain Birlasoft confidential or privileged information. If you are
  not the intended recipient,any disclosure,copying, use, or distribution of
  the information included in this message and any attachments is <br>
  prohibited. If you have received this communication in error, please notify
  us by reply e-mail at (<a href="mailto:administrator@birlasoft.com"
  moz-do-not-send=true>administrator@birlasoft.com</a>) and permanently delete
  this message and any attachments. Thank you.&quot;<br>
  *********************************************************************************************************************************************************************<u2:p></u2:p><o:p></o:p></span></font></p>
  </td>
 </tr>
</table>

<pre wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><u2:p>&nbsp;</u2:p><o:p></o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>

<hr size=4 width="90%" align=center>

</span></font></pre><pre style='text-align:center'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><u2:p>&nbsp;</u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>_______________________________________________<u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>mapguide-users mailing list<u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="mailto:mapguide-users@lists.osgeo.org" moz-do-not-send=true>mapguide-users@lists.osgeo.org</a><u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="http://lists.osgeo.org/mailman/listinfo/mapguide-users"
moz-do-not-send=true>http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><u2:p></u2:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>&nbsp; <u2:p></u2:p><o:p></o:p></span></font></pre>

<table class=MsoNormalTable border=0 cellpadding=0>
 <tr>
  <td bgcolor=white style='background:white;padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
  style='font-size:12.0pt'>*********************************************************************************************************************************************************************<br>
  &quot;This message and any attachments are solely for the intended recipient
  and may contain Birlasoft confidential or privileged information. If you are
  not the intended recipient,any disclosure,copying, use, or distribution of
  the information included in this message and any attachments is <br>
  prohibited. If you have received this communication in error, please notify
  us by reply e-mail at (<a href="mailto:administrator@birlasoft.com">administrator@birlasoft.com</a>)
  and permanently delete this message and any attachments. Thank you.&quot;<br>
  *********************************************************************************************************************************************************************<o:p></o:p></span></font></p>
  </td>
 </tr>
</table>

<pre wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>

<hr size=4 width="90%" align=center>

</span></font></pre><pre><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>_______________________________________________<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>mapguide-users mailing list<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>&nbsp; <o:p></o:p></span></font></pre></div>

</body>

</html>

<table><tr><td bgcolor=#ffffff><font color=#000000>*********************************************************************************************************************************************************************<br>
"This message and any attachments are solely for the intended recipient and may contain Birlasoft confidential or privileged information. If you are not the intended recipient,any disclosure,copying, use, or distribution of the information included in this message and any attachments is <br>
prohibited. If you have received this communication in error, please notify us by reply e-mail at (administrator@birlasoft.com) and permanently delete this message and any attachments. Thank you."<br>
*********************************************************************************************************************************************************************<br>
</font></td></tr></table>