<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top" style="font: inherit;">Hi thanks Jackie..<br>I've resolved this months ago, but thanks a lot anyway!!!<br>happy new year :)<br><br>--- On <b>Fri, 12/26/08, Jackie Ng-2 (via Nabble) <i>&lt;<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2096880&i=0" target="_top" rel="nofollow">ml-user+148234-933299064@...</a>&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">From: Jackie Ng-2 (via Nabble) &lt;<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2096880&i=1" target="_top" rel="nofollow">ml-user+148234-933299064@...</a>&gt;<br>Subject: Re: Need help in layerdfefinition<br>To: "lornen" &lt;<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2096880&i=2" target="_top" rel="nofollow">lor_nen@...</a>&gt;<br>Date: Friday, December 26, 2008, 9:37 AM<br><br><div id="yiv1809158353">

Try capturing that xml output, save it to a temp file, and validate it against the LayerDefinition-1.0.0.xsd schema. Visual Studio (assuming you have it) can easily validate the xml for you.
<br><br>- Jackie
<br><br><blockquote class="quote light-black dark-border-color"><div class="quote light-border-color">
<div class="quote-author" style="font-weight: bold;">lornen wrote:</div>
<div class="quote-message shrinkable-quote">Hi,
<br><br>This is my first time using MapGuide Enterprise, and I would appreciate some help. 
<br>I am getting a XML Parser exception when I tried to SetResource at the last line of the code.
<br><br><b>&nbsp;CODE:
<br>&nbsp; &nbsp; &nbsp; &nbsp; private void CreateMarkupLayer()
<br>&nbsp; &nbsp; &nbsp; &nbsp; {
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string markupName = "redline";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgSiteConnection site = getSite();
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgResourceService resourceService = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgFeatureService featureService = (MgFeatureService) site.CreateService(MgServiceType.FeatureService);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create the Markup Feature Source (SDF)
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgResourceIdentifier markupID = new MgResourceIdentifier("Library://Markup/" + markupName + ".FeatureSource");
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgFeatureSchema markupSchema = MarkupSchemaFactory.CreateMarkupSchema();
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgCreateSdfParams sdfParams = new MgCreateSdfParams("LL84", LL84WKT, markupSchema);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; featureService.CreateFeatureSource(markupID, sdfParams);
<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LayerDefinitionFactory factory = new LayerDefinitionFactory();
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a line rule.
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string legendLabel = "";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string filter = "";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string color = "FF0000FF";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string lineRule = factory.CreateLineRule(legendLabel,filter,color);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a line type style.
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string lineTypeStyle = factory.CreateLineTypeStyle(lineRule);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create a scale range.
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string minScale = "0";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string maxScale = "1000000000000";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string lineScaleRange = factory.CreateScaleRange(minScale, maxScale, lineTypeStyle);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Create the layer definiton.
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string featureClass = "Library://Markup/" + markupName + ".FeatureSource";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string featureName = "MarkupSchema:Markup";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string geometry = "SHPGEOM";
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string layerDefinition = factory.CreateLayerDefinition(featureClass, featureName,geometry,lineScaleRange);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XmlDocument doc = new XmlDocument();
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doc.LoadXml(layerDefinition);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.Text.UTF8Encoding utf = new System.Text.UTF8Encoding();
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte[] BytelayerDefinition = utf.GetBytes(layerDefinition);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgByteSource byteSource = new MgByteSource(BytelayerDefinition, BytelayerDefinition.Length);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byteSource.SetMimeType(MgMimeType.Xml);
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resourceService.SetResource(markupID, byteSource.GetReader(), null);
<br>&nbsp; &nbsp; &nbsp; &nbsp; }
<br></b><br><br>The string layerDefinition which i got from factory.CreateLayerDefinition() is as follows:
<br><b><br>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<br>&lt;LayerDefinition version="1.0.0" xmlns:xsi="<a rel="nofollow" target="_blank" href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:noNamespaceSchemaLocation="LayerDefinition-1.0.0.xsd"&gt;
<br>&nbsp; &nbsp; &lt;VectorLayerDefinition&gt;
<br>&nbsp; &nbsp; &nbsp; &lt;ResourceId&gt;Library://Markup/redline.FeatureSource&lt;/ResourceId&gt;
<br>&nbsp; &nbsp; &nbsp; &lt;FeatureName&gt;MarkupSchema:Markup&lt;/FeatureName&gt;
<br>&nbsp; &nbsp; &nbsp; &lt;FeatureNameType&gt;FeatureClass&lt;/FeatureNameType&gt;
<br>&nbsp; &nbsp; &nbsp; &lt;Geometry&gt;SHPGEOM&lt;/Geometry&gt;
<br>&nbsp; &nbsp; &nbsp; &lt;VectorScaleRange&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;MinScale&gt;0&lt;/MinScale&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;MaxScale&gt;1000000000000&lt;/MaxScale&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;LineTypeStyle&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;LineRule&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;LegendLabel&gt;&lt;/LegendLabel&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Filter&gt;&lt;/Filter&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;LineSymbolization2D&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;LineStyle&gt;Solid&lt;/LineStyle&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Thickness&gt;1&lt;/Thickness&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Color&gt;FF0000FF&lt;/Color&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;Unit&gt;Points&lt;/Unit&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/LineSymbolization2D&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/LineRule&gt;
<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/LineTypeStyle&gt;
<br>&nbsp; &nbsp; &nbsp; &lt;/VectorScaleRange&gt;
<br>&nbsp; &nbsp; &lt;/VectorLayerDefinition&gt;
<br>&nbsp; &lt;/LayerDefinition&gt;
<br></b><br><br>I'm using asp.net, c# and MapGuide Enterprise 2007
<br><br>Thanks
</div>
</div></blockquote>

<br><br>
<hr color="#cccccc" noshade="noshade" size="1">
<div style="color: rgb(102, 102, 102); font-family: tahoma,geneva,helvetica,arial,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">
            
This email is a reply to your post @ <a rel="nofollow" target="_blank" href="http://n2.nabble.com/Need-help-in-layerdfefinition-tp1814847p1814848.html">http://n2.nabble.com/Need-help-in-layerdfefinition-tp1814847p1814848.html</a><br>
You can reply by email or by visting the link above.<br>

</div>
<br>
</div></blockquote></td></tr></table><br>



      
<br><hr align="left" width="300">
View this message in context: <a href="http://n2.nabble.com/Need-help-in-layerdfefinition-tp1814847p2096880.html">Re: Need help in layerdfefinition</a><br>
Sent from the <a href="http://n2.nabble.com/MapGuide-Users-f1803227.html">MapGuide Users mailing list archive</a> at Nabble.com.<br>