[fdo-users] RE: [mapguide-internals] FeatureSource encoding of layers

Brent Robinson brent.robinson at autodesk.com
Wed Aug 20 11:33:56 EDT 2008

Hi Kenneth,

The -x00- encoding is done for any characters not allowed in XML element names. FDO performs this encoding on class and property names when it serializes feature schemas to XML. For the XML schemas themselves, these characters are ok since these names end up as values in name attribute fields. However, if the features themselves are serialized to XML, the class/property names become element names. The same encoding is applied to both XML schemas and XML feature to keep them consistent.

At the time the FDO XML handling was developed, we looked for a more standard encoding but weren't able to find one. HTML seems to use a %00 encoding but unfortunately % is one of the disallowed characters.

I don't know if there is a direct way to turn off the encoding when getting feature schemas from DESCRIBEFEATURESCHEMA.
However, it can be worked around by using the FDO API to deserialize and re-serialize the schemas. There are probably a few different ways to do it but if you can get the XML into a Byte array, the managed code would look something like:

        using OSGeo.FDO.Common.Io;
        using OSGeo.FDO.Schema;
        using OSGeo.FDO.XML;

        System.Byte xmlDoc[] = GetTheSchemas();

        IoMemorySteam xmlStream = new IoMemoryStream();
        xmlStream.Write( xmlDoc, xmlDoc.GetLength(0) );

        FeatureSchemaCollection schemas = new FeatureSchemaCollection(null);
        schemas.ReadXml( xmlStream );

        XmlFlags flags = new XmlFlags();
        flags.NameAdjust = false;        // This turns off the -x00- encoding

        xmlStream = new IoMemoryStream;
        schemas.WriteXml( xmlStream, flags );


        // use xmlStream.Read to extract the resulting XML doc from the stream.


-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Tom Fukushima
Sent: Tuesday, August 19, 2008 4:25 PM
To: MapGuide Internals Mail List; FDO Users Mail List
Subject: [fdo-users] RE: [mapguide-internals] FeatureSource encoding of layers

Hi Kenneth,

That particular document is created by FDO, could you post this question to the FDO users mailing list?  Oh, wait, I just did.


-----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: Monday, August 18, 2008 2:26 AM
To: MapGuide Internals Mail List
Subject: [mapguide-internals] FeatureSource encoding of layers

I have some bug reports regarding wrong encoding of spaces and other

After checking up on the problem, it turns out that the
"DESCRIBEFEATURESCHEMA" returns an xml with these encoded characters.
The characters turn up in the class name part of the xml (name, type,
key, selector elements).
It is easy to detect and re-code, as they are of the form -x00- where 00
is the charaters hex value.
Entering either the encoded or unencoded value into the Schema field of
the "DESCRIBEFEATURESCHEMA" call, gives the same results.

The question is, why are they there?

When, if ever, should the names be passed encoded to the server?
Are there a better call that does not encode the names?
(GETCLASSES returns the unencoded names, but no column data)

Regards, Kenneth Skovhede, GEOGRAF A/S

mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
fdo-users mailing list
fdo-users at lists.osgeo.org

More information about the fdo-users mailing list