MISMO® is a leading technology standards development body for the residential and commercial real estate finance industries.
MISMO has identified two deliverables that will enable the mortgage industry to share data among trading partners.
- An XML architecture that encompasses data origination, secondary market and servicing data
- A data dictionary to provide business definitions and corresponding architecture data element tag names
MISMO defines guidelines used in the delivery of their specifications; in particular, MISMO Engineering Guidelines (MEGs) are intended to assist with the creation of "consistent and technically appropriate XML". It is expected that "The Guidelines shall be adhered to ... without any deviation". In addition to the released MEGS, MISMO's Architecture Workgroup wiki maintains a more comprehensive list of MEGs, in various stages of completion.
To illustrate how Query XSD Analysis may be used to check MISMO compliance, we use the Residential Reference Model version 3.2.0 (B292) available from the MISMO Residential Specifications website.
Setup
- Download and extract the MISMO XSDs from the Residential Reference Model version 3.2.0.
- Create an XML Schema Refactoring file.
- Create a new XML Schema Collection and add MISMO_3.2.0_B292Combined.xsd file to it.
The result should look similar to this.
MEG 0003 Compliance
MEG0003 is an XML namespaces related guideline.
Guideline 3.3 states that
For Version 3.x, the namespace is: http://www.mismo.org/residential/2009/schemas
In terms of XSDs, the combined MISMO schema release has the following layout.
The following query displays the list of XSDs and their associated attributes:
SELECT * from XSSchema
WHERE XSSchema.SchemaSet IS NOT NULL
Result (some columns dropped for readability):
Schema Set |
Attribute Form Default |
Block Default |
Element Form Default |
Final Default |
Target Namespace |
Version |
Items Count |
External References Count |
MISMO, Version 3.2.0 |
Unqualified |
None |
Qualified |
None |
http://www.mismo.org/residential/2009/schemas |
|
2957 |
1 |
MISMO, Version 3.2.0 |
Qualified |
None |
Qualified |
None |
http://www.w3.org/1999/xlink |
|
26 |
0 |
A compliance report may check that a given Schema Set contains XSDs with target namespaces as described by the MEG0003 guideline. Depending on an organization policy, other target namespaces, outside the set needed to support MISMO, may be flagged as design exceptions.
Guideline 3.4 states that
The Namespace prefix for MISMO Schemas MUST be “mismo:”.
The following query displays the list of aliases associated with the http://www.mismo.org/residential/2009/schemas namespace.
SELECT * FROM XSObjectNamespaces
WHERE XSObjectNamespaces.Namespace = 'http://www.mismo.org/residential/2009/schemas'
Result (some columns dropped for readability):
Schema Set |
Alias |
Namespace |
MISMO, Version 3.2.0 |
|
http://www.mismo.org/residential/2009/schemas |
MISMO, Version 3.2.0 |
mismo |
http://www.mismo.org/residential/2009/schemas |
Guideline 3.5 states that
The W3C XML Schema Namespace prefix used for published MISMO Schemas SHOULD be “xsd:”
The following query displays the list of aliases for the http://www.w3.org/2001/XMLSchema namespace that are NOT "xsd"
SELECT * FROM XSObjectNamespaces
WHERE XSObjectNamespaces.Namespace = 'http://www.w3.org/2001/XMLSchema' AND XSObjectNamespaces.Alias != 'xsd'
Guideline 3.7 states that
MISMO Schemas MUST NOT use namespace defaulting.
The following query finds all the schemas without a target namespace that are directly or indirectly included by a schema with a target namespace (MISMO 3.1.0 B288 in fact used chameleon composition).
SELECT * FROM XSSchema S1 INNER JOIN XSSchema S2 on S1.SourceUri = S2.SourceUri
WHERE S1.TargetNamespace IS NULL AND S2.TargetNamespace IS NOT NULL
Guideline 3.8 states that
Namespaces MUST NOT use relative URIs.
The following query finds all the schema with a target namespace that use invalid URIs and/or relative URIs.
SELECT * FROM XSSchema
WHERE XSSchema.TargetNamespace IS NOT NULL AND ISNULL(UriIsAbsolute(XSSchema.TargetNamespace), 0) = 0
Guideline 3.9 states that
Namespaces MUST NOT use xml:base.
The following query finds all the xml:base nodes.
SELECT * FROM XNode
WHERE XNode.NamespaceURI= 'http://www.w3.org/XML/1998/namespace' and XNode.LocalName = 'base'
MEG 0007 Compliance
MEG0007 is a class words related guideline. It indicates the accepted suffixes for every data point name (term) as being from an approved class words list.
Guideline 7.5.1 states that
Amount: The numeric value of a quantity of monetary currency in US dollars unless otherwise specified.
MISMO Data Type: MISMOAmount
XML Data Type: xsd:decimal with optional CurrencyURI attribute.
To verify compliance of a MISMO schema set against this guideline, the following would indicate the elements that:
- Use the Amount suffix, but are not of a MISMOAmount type or subtype.
- Are of a MISMOAmount type or subtype, but do not use the Amount suffix.
SELECT XSObject.SchemaSet,
XSObject.SourceUri,
XSObject.LineNumber,
XSObject.LinePosition,
XSElement.LocalName + ' ends in Amount, yet its ultimate base type is not MISMOAmount; {' + XSElement.TypeNamespace + '}' + XSElement.TypeLocalName as Message
FROM XSElement
INNER JOIN XSObject on XSElement.RowId = XSObject.RowId
WHERE RegexIsMatch(XSElement.LocalName, 'Amount$', 0) = 1 AND XSElement.SchemaTypeRowId NOT IN
(SELECT AllDescendents.RowId
FROM AllDescendents
WHERE AllDescendents.BaseTypeNamespace = 'http://www.mismo.org/residential/2009/schemas' AND AllDescendents.BaseTypeName = 'MISMOAmount')
AND (XSElement.TypeLocalName != 'MISMOAmount' OR XSElement.TypeNamespace != 'http://www.mismo.org/residential/2009/schemas')
UNION
SELECT XSObject.SchemaSet,
XSObject.SourceUri,
XSObject.LineNumber,
XSObject.LinePosition,
XSElement.LocalName + ' doesn''t end in Amount, yet its ultimate base type is MISMOAmount.' as Message
FROM XSElement
INNER JOIN XSObject on XSElement.RowId = XSObject.RowId
WHERE RegexIsMatch(XSElement.LocalName, 'Amount$', 0) = 0 AND
(XSElement.SchemaTypeRowId IN
(SELECT AllDescendents.RowId
FROM AllDescendents
WHERE AllDescendents.BaseTypeNamespace = 'http://www.mismo.org/residential/2009/schemas' AND AllDescendents.BaseTypeName = 'MISMOAmount')
OR (XSElement.TypeLocalName = 'MISMOAmount' AND XSElement.TypeNamespace = 'http://www.mismo.org/residential/2009/schemas'))
To see the result, create a sample test schema as below:
<?xml version="1.0" encoding="utf-8"?>
<!--XML Schema generated by QTAssistant/XSR Module (http://www.paschidev.com)-->
<xsd:schema xmlns="http://www.mismo.org/residential/2009/schemas" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.mismo.org/residential/2009/schemas" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:include schemaLocation="MismoRefModel_v3.2.0_B292/Combined/MISMO_3.2.0_B292Combined.xsd" />
<xsd:element name="SomeInvalidAmount" type="xsd:decimal"/>
<xsd:element name="OtherInvalidAmountExample" type="MISMOAmount"/>
</xsd:schema>
Running the above script against it would produce this result:
Schema Set |
Source Uri |
Line Number |
Line Position |
Message |
MISMO, Version 3.2.0 |
file:///X:/.../Test.xsd |
5 |
3 |
SomeInvalidAmount ends in Amount, yet its ultimate base type is not MISMOAmount; {http://www.w3.org/2001/XMLSchema}decimal |
MISMO, Version 3.2.0 |
file:///X:/.../Test.xsd |
6 |
3 |
OtherInvalidAmountExample doesn't end in Amount, yet its ultimate base type is MISMOAmount. |
For arbitrary schema sets, a pre-requisite would be to ensure that {http://www.mismo.org/residential/2009/schemas}MISMOAmount exists.
All other 7.5.x can be implemented similar to 7.5.1.