VisualSchemas For B2MML

VisualSchema.com has released Visual Schemas for B2MML. This standard has been brought to our attention by Dennis Brandl of BR&L CONSULTING, INC.

After an initial hickup with case mismatch between the schemaLocation field and the actual filename, the generation of Visual Schemas for B2MML went smoothly, except for one thing. B2MML defines Location recursively. VisualSchema can handle recursion. However, it was noted that Visual Schema generated Location -> Location -> “Location add” rather than generating Location -> “Location Add”. In other words, it has generated a location element within a location element while it is supposed to generate only the top level location element. I mean, recognizing recursion shouldn’t require going through two elements, isn’t it?

Unpon examination, it was found that a top level LocationType is defined which makes use of a Location element (which is defined inside this type and hence not a top-level element) that is of type LocationType. Then, in the equipment xsd, a top-level Location element is defined with type LocationType. As a result, the top-level element Location and the inner element Location, while are the same type, are not recognized as one and the same as per XMLSchema semantics. So, Visual Schema has been fixed to detect the recursion not only purely based on the matching element definition objects but also based on the matching of name and type fields. With this fix, only one Location element got created.

To avoid the above situation, the right way of defining the XML Schema definition is to define a top level Type called LocationType along with a top-level element called Location that is of type LocationType and then use this top-level element as a reference in the LocationType definition that uses the Location recursively. Modified the B2MML using this strategy and without the above VisualSchema fix of comparing the name and type fields instead of just the definition objects (object reference comparison) the strategy worked fine.