[mapguide-users] SQL where equivalent - ASP.NET example - Creating Layers By Modifying XML

Kenneth, GEOGRAF A/S ks at geograf.dk
Thu Aug 2 04:44:56 EDT 2007


I don't have sample code to show, but you should use the 
GetResource/SetResource calls.
These will return/take an MgByteReader.
The reader holds a binary version of the Xml document.
if you use write the content into a regular .Net stream, you can read it 
with the System.Xml calls.

When you write it back, there are a number of caveats:
1. The document must be UTF-8 encoded
2. The document must contain spaces between tags, otherwise Studio won't 
show it.
3. If the XmlWriter decides to prefix the byte stream with the UTF-8 
byte order tags, you must remove them.

The MgByteReader is a bit annoying to work with, as it only returns 
chunks of 8K data, and looses data when transfered to a function.

Regards, Kenneth, GEOGRAF A/S



jas skrev:
> I am trying to replicate the SQL Where functionality that was used in MG6.5
> or earlier. I have looked at the DEV Guide and checked out the forum and
> found the 2 methods explained and the one I am interested in is the saved
> XML approach.
> Does anyone have some sample code, written .NET, that modifies the filter
> applied to a layer for that particular session. I am new to .NET. 
>
> Dev Guide page 56 
>
> "Creating Layers By Modifying XML"
> 1              Build a prototype layer through the Studio UI. To make the
> scripting
> simpler, this layer should have as many of the correct settings as can be
> determined in advance.
> 2              Use Studio’s Save as Xml command to save the layer as an XML
> file.
> 3              Have the script load the XML file and then use the DOM
> (Document
> Object Model) to change the necessary XML elements.
> 4              Add the modified layer to the map.
>
>
> Appreciate your help
>   


More information about the mapguide-users mailing list