[mapguide-internals] Re: Note on MapGuide resource XML documents - converting between different schema versions

Tom Fukushima tom.fukushima at autodesk.com
Wed Mar 11 18:08:59 EDT 2009


Hi Kenneth,

RFC http://trac.osgeo.org/mapguide/wiki/MapGuideRfc10 describes this.

I could see it used by someone who is testing a sandboxed feature and wants to extend the data; the feature might take a while to implement so they would need to use the extended data for a while (perhaps even over a couple of releases).  Once we are satisfied that we want to put the feature in the project, they fix up the parser and update the version of the schema.  The users in this case would be the developer, and any users who are trying out the feature.


-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Kenneth Skovhede, GEOGRAF A/S
Sent: Wednesday, March 11, 2009 3:48 PM
To: Walt Welton-Lair
Cc: MapGuide Internals Mail List
Subject: [mapguide-internals] Re: Note on MapGuide resource XML documents - converting between different schema versions

Thanks for the notification.

Would the ExtendedData be used by anyone other than MapGuide developers 
testing new features?

Regards, Kenneth Skovhede, GEOGRAF A/S



Walt Welton-Lair skrev:
> Hi Kenneth,
>
> I'm currently fixing a MapGuide Studio bug in which the code is not properly converting legacy layer definitions (those saved using schema versions 1.2.0 or earlier) to the latest version.  Basically the code was obtaining the legacy XML stream from the MapGuide server and was feeding it into a deserialization class which was expecting version 1.3.0 of the layer definition schema.
>
> A simple way to handle conversions from one version to another is via the open source MdfParser project - it contains all the logic to do the necessary conversion.  The process is fairly straightforward:
>
> char* xmlData = ...;  // UTF8-encoded XML string
>
> // deserialize into an MdfModel::LayerDefinition
> MdfParser::SAX2Parser parser;
> parser.ParseString(xmlData, strlen(xmlData));
>
> // get the layer and reserialize using the latest schema
> MdfModel::LayerDefinition* pLayerDef = parser.DetachLayerDefinition();
> std::string xmlDataTranslated = parser.SerializeToXML(pLayerDef, NULL);
> delete pLayerDef;
>
> // for symbol definitions use the following instead
> //MdfModel::SymbolDefinition* pSymbolDef = parser.DetachSymbolDefinition();
> //std::string xmlDataTranslated = parser.SerializeToXML(pSymbolDef, NULL);
>
>
> A good example of the kind of conversion that needs to happen: legacy layer definition XML documents can contain ExtendedData1 elements containing sub-elements that are only supported by later schema versions (see https://trac.osgeo.org/mapguide/wiki/MapGuideRfc10).  The MdfParser code processes these ExtendedData1 elements and accounts for them when generating the MdfModel::LayerDefinition.  When you re-serialize the layer using the latest schema version the ExtendedData1 elements no longer appear.
>
> Another recent conversion example is this one: https://trac.osgeo.org/mapguide/changeset/3642.
>
> Anyway, since you work on Maestro I just wanted to share that.  I'm assuming Maestro allows users to open and edit legacy resources, so it's important that it handles these conversions correctly.  I'm also CC'ing 'MapGuide Internals' since this information may be useful to others as well.
>
> Thanks,
> Walt
>
>  W       E         @__   __o
>    A   T   R   @___    _ \<,_
>      L           @_   (*)/ (*)
>
>
>   
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals


More information about the mapguide-internals mailing list