[mapguide-internals] PATCH: MgNullableProperty XML serialization fix

Tom Fukushima tom.fukushima at autodesk.com
Tue Apr 13 17:22:08 EDT 2010


I'm looking at this and I think our schema is wrong.  I believe these changes are for the schema defined by BatchPropertyCollection-1.0.0.xsd.

I know that you and Zac had discussed this last week in a different thread, but I didn't realize what it was about at the time, sorry.  Now let me try to explain...

To be able to define null values, we only need to not specify the <Value> element.  For example, to specify Owner=null we would write <Name>Owner</Name><Type>string</Type>.  Compare with Owner="Tom" which is specified as <Name>Owner</Name><Type>string</Type><Value>Tom</Value>.  Unfortunately our schema doesn't allow this because the Value element has the (default) constraints of minoccurs=1 and maxoccurs=1.  I think that we should change the schema so that the value element is defined as:
  <xs:element name="Value" type="xs:string" minOccurs="0"/>
Once we do this, then we can specify null values as above.

Strictly speaking, we would need to rev the schema, but I wonder if we would be able to get away with making the change in place this time (i.e., just updating the 1.0.0 schema).  I guess, the problem would be if there are any clients that consume this format; they will need to be able to handle the case where the value elements are missing---however, given that no one has probably been able to use this because null values have caused crashes, I think no one would be affected.  Not sure though, anyone see any problems with treating this as a bug in the schema and just fixing it?

Tom

-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Jackie Ng
Sent: Tuesday, April 13, 2010 8:24 AM
To: mapguide-internals at lists.osgeo.org
Subject: [mapguide-internals] PATCH: MgNullableProperty XML serialization fix

Hi All,

Could you please review this patch, which fixes the XML serialization of MgNullableProperty subclasses.

The patch simply places an IsNull() check around the code that writes the actual value between the <Value></Value> elements, such that a null property value will not write anything between the elements. For the MgGeometryProperty, an additional exception handler is in place to handle exceptions thrown due to invalid geometry (such as Sheboygan Parcels record #97). Again, nothing is written if an exception is caught when attempting to get the text of the geometry.

This fixes a whole load of tickets (all related) including:

- #708
- #1228
- #1238
- #1080

This patch results in a SELECTFEATURES mapagent operation that is actually usable instead of blowing up on any feature source containing null values

In case you can't see the attached patch, I've put another copy as an attachment to ticket 708.

- Jackie

--
Blog: http://themapguyde.blogspot.com
LinkedIn: http://www.linkedin.com/in/jackieng
Twitter: http://twitter.com/jumpinjackie


More information about the mapguide-internals mailing list