MISMO Trimester Meeting January 23

advertisement

Overview of XML Schema

Greg Alvord

Senior Data Architect, RealEC

Chairman Architecture Committee

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

• Motivation

• W3C Schema

Agenda

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

Motivation For Schema

• Why Did MISMO switch from DTD to

Schema?

– W3C Schema did not exist when 2.X Started

• First goal of V3 was to use schema

– DTD does not have data typing

– Most Development tools use schema

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

DTD does not have data typing

• V2 Approach.

– Date is a string

– Implementation Guide states format

– Many developers never saw the IG Poorly formed date data huge drain on productivity.

• V3 Approach

– Xsd:date data type format same as V2 recommendation. (ISO 8601)

– Test by schema validation

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

Motivation For Schema

• Why Should Developers Understand Schema?

– Schema is your specifications

• Structure

• Data Types

• Documentation

– If your code produces XML

• Test your output with schema

– If your code accepts XML

• Require schema valid input.

• Schema validate input

– Development

– Testing

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

A Few Best Practices

• NEVER make or consume XML as string.

• Better to use an XML object in whatever library you are using.

– XML Objects usually have a serialized string property.

• Best to use data model object and serialize or de-serialize to XML.

– Use .NET XSD.exe to read schema write object model.

– Use other similar tools in other platforms.

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

MISMO use of Schema

• XSD Extension on published Schema files

• xsd: prefix in schema files.

• Most data in xsd:element

– Security attributes

– Connecting attributes

– Other attributes.

• XML Encryption

• XML Signature

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

MISMO use of Schema

• Namespace used

– Root file MISMO_3.2.0_B290.xsd

<xsd:schema xmlns="http://www.mismo.org/residential/2009/schemas" targetNamespace= http://www.mismo.org/residential/2009/schemas

• Chameleon – xsd:include files

– No target namespace

– No declared namespace

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

Namespace

• Why does it look like a URL?

– URL is kind of URI

– http: Means we could, but have not yet, make a page available.

• Why does it contain 2009?

– Change Namespace with release

– Fixed Namespace (X)

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

MISMO use of Schema

• Some data in xsd:attributes

– //LOANS/LOAN/@SequenceNumber

– //LOANS/LOAN/@LoanRoleType

• SubjectLoan – The loan that is the object of the transaction, upon which the receiving business partner will take some action.

• RelatedLoan – A loan linked to the subject loan by virtue of being collateralized by the same property.

Examples include the loan being refinanced, or a

HELOC or other subordinate lien collateralized by the same property as the subject loan.

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

Sequence And Choice Group

• xsd:sequence

• Defines order of element children

– Order counts

– Lexicographically ordered list

• Lexicographical order is called “Dictionary order”

Capitalizations and white space is ignored. “_” is treated like a space.

• xsd:choice

– Defines exclusive choice

– Comes before other elements

MISMO Trimester Meeting

January 23-27, 2012 Jacksonville, Florida

Download