<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><<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2096880&i=0" target="_top" rel="nofollow">ml-user+148234-933299064@...</a>></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) <<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2096880&i=1" target="_top" rel="nofollow">ml-user+148234-933299064@...</a>><br>Subject: Re: Need help in layerdfefinition<br>To: "lornen" <<a href="http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2096880&i=2" target="_top" rel="nofollow">lor_nen@...</a>><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> CODE:
<br> private void CreateMarkupLayer()
<br> {
<br> string markupName = "redline";
<br> MgSiteConnection site = getSite();
<br> MgResourceService resourceService = (MgResourceService)site.CreateService(MgServiceType.ResourceService);
<br> MgFeatureService featureService = (MgFeatureService) site.CreateService(MgServiceType.FeatureService);
<br> // Create the Markup Feature Source (SDF)
<br><br> MgResourceIdentifier markupID = new MgResourceIdentifier("Library://Markup/" + markupName + ".FeatureSource");
<br> MgFeatureSchema markupSchema = MarkupSchemaFactory.CreateMarkupSchema();
<br> MgCreateSdfParams sdfParams = new MgCreateSdfParams("LL84", LL84WKT, markupSchema);
<br> featureService.CreateFeatureSource(markupID, sdfParams);
<br><br> LayerDefinitionFactory factory = new LayerDefinitionFactory();
<br> // Create a line rule.
<br> string legendLabel = "";
<br> string filter = "";
<br> string color = "FF0000FF";
<br> string lineRule = factory.CreateLineRule(legendLabel,filter,color);
<br> // Create a line type style.
<br> string lineTypeStyle = factory.CreateLineTypeStyle(lineRule);
<br> // Create a scale range.
<br> string minScale = "0";
<br> string maxScale = "1000000000000";
<br> string lineScaleRange = factory.CreateScaleRange(minScale, maxScale, lineTypeStyle);
<br> // Create the layer definiton.
<br> string featureClass = "Library://Markup/" + markupName + ".FeatureSource";
<br> string featureName = "MarkupSchema:Markup";
<br> string geometry = "SHPGEOM";
<br> string layerDefinition = factory.CreateLayerDefinition(featureClass, featureName,geometry,lineScaleRange);
<br> XmlDocument doc = new XmlDocument();
<br> doc.LoadXml(layerDefinition);
<br> System.Text.UTF8Encoding utf = new System.Text.UTF8Encoding();
<br> byte[] BytelayerDefinition = utf.GetBytes(layerDefinition);
<br> MgByteSource byteSource = new MgByteSource(BytelayerDefinition, BytelayerDefinition.Length);
<br> byteSource.SetMimeType(MgMimeType.Xml);
<br> resourceService.SetResource(markupID, byteSource.GetReader(), null);
<br> }
<br></b><br><br>The string layerDefinition which i got from factory.CreateLayerDefinition() is as follows:
<br><b><br><?xml version="1.0" encoding="UTF-8"?>
<br><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">
<br> <VectorLayerDefinition>
<br> <ResourceId>Library://Markup/redline.FeatureSource</ResourceId>
<br> <FeatureName>MarkupSchema:Markup</FeatureName>
<br> <FeatureNameType>FeatureClass</FeatureNameType>
<br> <Geometry>SHPGEOM</Geometry>
<br> <VectorScaleRange>
<br> <MinScale>0</MinScale>
<br> <MaxScale>1000000000000</MaxScale>
<br> <LineTypeStyle>
<br> <LineRule>
<br> <LegendLabel></LegendLabel>
<br> <Filter></Filter>
<br> <LineSymbolization2D>
<br> <LineStyle>Solid</LineStyle>
<br> <Thickness>1</Thickness>
<br> <Color>FF0000FF</Color>
<br> <Unit>Points</Unit>
<br> </LineSymbolization2D>
<br> </LineRule>
<br> </LineTypeStyle>
<br> </VectorScaleRange>
<br> </VectorLayerDefinition>
<br> </LayerDefinition>
<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>