Designing XML Formats: Versioning vs' Extensibility - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Designing XML Formats: Versioning vs' Extensibility

Description:

Atom 0.3 - Atom 1.0 [Blogger] Poor Versioning Story Hurts Migration to New Formats ... targetNamespace='http://www.example.com/person' elementFormDefault='qualified' ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 25
Provided by: gca
Category:

less

Transcript and Presenter's Notes

Title: Designing XML Formats: Versioning vs' Extensibility


1
Designing XML Formats Versioning vs.
Extensibility
  • Dare Obasanjo
  • Program Manager
  • Microsoft Corporation
  • dareo_at_microsoft.com

2
Definition Versioning
  • The process for modifying an XML format over
    subsequent releases v1.0 -gt v1.1 -gt v2.0 -gt v3.0
  • Types of versioning
  • Backward compatible v2.0 format -gt v1.0 consumer
  • Forward compatible v1.0 format -gt v2.0 consumer
  • Types of changes
  • Breaking change a change that is not backward or
    forward compatible
  • Non-breaking change a change that is backward
    and forward compatible

3
Why is Versioning Important?
  • Need Ways to Migrate Users from Services
  • SOAP 1.1 -gt SOAP 1.2 Google, Amazon, eBay
  • Atom 0.3 -gt Atom 1.0 Blogger
  • Poor Versioning Story Hurts Migration to New
    Formats
  • HTML -gt XHTML
  • XML 1.0 -gt XML 1.1

4
Message Transfer Negotiation
  • On closed networks like LANs or where formal
    agreements made before message exchange occurs
  • Versioning can be done out of band
  • Versions of format used can be fixed

5
Versioning Message Payloads
  • On WANs like the WWW message exchange done
    without a priori agreements
  • Its hard or impossible to upgrade all clients
    and servers at the same time
  • Messages should carry versioning information
  • This is the scenario we care about

6
Definition Extensibility
  • A mechanism that enables new data to show up side
    by side (or concurrently) with data for a given
    format
  • Typically version-independent
  • Primarily benefits third parties who want to
    extend the format

7
Why is Extensibility Important?
  • Enables evolution without central control of the
    format
  • Not limited to XML formats. Consider extensible
    headers in HTTP, email and USENET.
  • Simplifies the format by pushing niche use cases
    out of the core
  • RSS 2.0 Extensions for reading posting
    comments
  • XSD Embedded Schematron and SQLXML annotated
    schemas

8
Example Person 1.0
  • ltperson version"1.0" xmlns"http//www.example.or
    g/person" gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • lt/persongt

9
Version Numbers vs. Namespace Names
  • The namespace name is part of the identity
  • Changing namespace name breaks namespace-aware
    applications such as XSLT, XPath, etc
  • Use version numbers for minor revisions and
    change namespace name for major revisions
  • Version numbers primarily for human readers
  • Practice is inconsistent today
  • SOAP 1.1 -gt SOAP 1.2 (different namespace)
  • XSLT 1.0 -gt XSLT 2.0 (same namespace)

10
Example Person 1.1
  • ltperson version"1.1" xmlns"http//www.example.or
    g/person" gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • ltmiddle-initialgtJlt/middle-initialgt
  • lt/persongt

11
Example Person 2.0
  • ltperson version"2.0" xmlns"http//www.example.or
    g/person2" gt
  • ltnamegt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • ltmiddle-initialgtJlt/middle-initialgt
  • lt/namegt
  • ltssngt123-45-6789lt/ssngt
  • lt/persongt

12
The Unique Particle Attribution problem I
  • ltperson version"1.0" xmlns"http//www.example.or
    g/person" gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • lt/persongt
  • ltxsschema xmlnsxs"http//www.w3.org/2001/XMLSch
    ema" targetNamespace"http//www.example.com/perso
    n" elementFormDefault"qualified"gt
  • ltxselement name"person"gt
  • ltxscomplexTypegt
  • ltxssequencegt
  • ltxselement name"first-name"
    type"xsstring" /gt
  • ltxselement name"last-name"
    type"xsstring" /gt
  • ltxsany minOccurs"0" maxOccurs"unbounded"
    namespace"targetNamespace" /gt
  • lt/xssequencegt
  • ltxsattribute name"version" type"xsstring"
    /gt
  • lt/xscomplexTypegt
  • lt/xselementgt
  • lt/xsschemagt

13
The Unique Particle Attribution problem II
  • ltperson version"1.1" xmlns"http//www.example.or
    g/person" gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • ltmiddle-initialgtJlt/middle-initialgt
  • lt/persongt
  • ltxsschema xmlnsxs"http//www.w3.org/2001/XMLSch
    ema" targetNamespace"http//www.example.com/perso
    n" elementFormDefault"qualified"gt
  • ltxselement name"person"gt
  • ltxscomplexTypegt
  • ltxssequencegt
  • ltxselement name"first-name"
    type"xsstring" /gt
  • ltxselement name"last-name"
    type"xsstring" /gt
  • ltxselement name"middle-initial"
    type"xsstring" minOccurs"0" /gt
  • ltxsany minOccurs"0" maxOccurs"unbounded"
    namespace"targetNamespace" /gt
  • lt/xssequencegt
  • ltxsattribute name"version" type"xsstring"
    /gt
  • lt/xscomplexTypegt
  • lt/xselementgt
  • lt/xsschemagt

14
The Unique Particle Attribution problem contd
  • ltxssequencegt
  • ltxselement name"first-name"
    type"xsstring" /gt
  • ltxselement name"last-name"
    type"xsstring" /gt
  • ltxselement name"middle-initial"
    type"xsstring" minOccurs"0" /gt
  • ltxsany minOccurs"0" maxOccurs"unbounded"
    namespace"targetNamespace" /gt
  • lt/xssequencegt

15
XSD Techniques Versioning
  • New constructs in new namespace
  • Elements and attributes from subsequent versions
    use different namespace

16
New constructs in new namespace I
  • ltperson version"1.0" xmlns"http//www.example.or
    g/person" gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • lt/persongt
  • ltperson version"1.1" xmlns"http//www.example.or
    g/person"
  • xmlnsv11"http//www.example.org/personv11
    " gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • ltv11middle-initialgtJlt/v11middle-initialgt
  • lt/persongt
  • ltxsschema xmlnsxs"http//www.w3.org/2001/XMLSch
    ema" targetNamespace"http//www.example.com/perso
    n" elementFormDefault"qualified"gt
  • ltxselement name"person"gt
  • ltxscomplexTypegt
  • ltxssequencegt
  • ltxselement name"first-name"
    type"xsstring" /gt
  • ltxselement name"last-name"
    type"xsstring" /gt
  • ltxsany minOccurs"0" maxOccurs"unbounded"
    namespace"other" /gt
  • lt/xssequencegt
  • ltxsattribute name"version" type"xsstring"
    /gt
  • lt/xscomplexTypegt
  • lt/xselementgt
  • lt/xsschemagt

17
New constructs in new namespace II
  • Pro
  • Straight forward
  • Con
  • Cant differentiate extensions from core
  • Con Additional schema documents needed for
    subsequent versions
  • Con not forward compatible in a number of cases

18
XSD Techniques Versioning
  • Using extensibility points with sentries
  • Extensibility points bounded by delimiters
  • Pro Constructs in format use same namespace
  • Con Adds complexity to format

19
Using extensibility points with sentries I
  • ltperson version"1.0" xmlns"http//www.example.or
    g/person" gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • lt/persongt
  • ltperson version"1.1" xmlns"http//www.example.or
    g/person"
  • gt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • ltdelimiter /gt
  • ltmiddle-initialgtJlt/middle-initialgt
  • ltend /gt
  • lt/persongt
  • ltxsschema xmlnsxs"http//www.w3.org/2001/XMLSch
    ema"
  • xmlnsp"http//www.example.org/person"
    targetNamespace"http//www.example.com/person"
    elementFormDefault"qualified"gt
  • ltxselement name"delimiter"gt
  • ltxscomplexType /gt
  • lt/xselementgt
  • ltxselement name"end"gt
  • ltxscomplexType /gt
  • lt/xselementgt
  • ltxselement name"person"gt
  • ltxscomplexTypegt
  • ltxssequencegt
  • ltxselement name"first-name"
    type"xsstring" /gt
  • ltxselement name"last-name"
    type"xsstring" /gt
  • ltxssequence minOccurs"0" maxOccurs"1"gt
  • ltxssequence minOccurs"0"
    maxOccurs"unbounded"gt
  • ltxselement ref"pdelimiter" /gt
  • ltxsany namespace"targetNamespace
    local" minOccurs"0" maxOccurs "unbounded"/gt
  • lt/xssequencegt
  • ltxselement ref"pend" /gt

20
Using extensibility points with sentries I contd
  • ltxssequencegt
  • ltxselement name"first-name"
    type"xsstring" /gt
  • ltxselement name"last-name"
    type"xsstring" /gt
  • ltxssequence minOccurs"0" maxOccurs"1"gt
  • ltxssequence minOccurs"0"
    maxOccurs"unbounded gt
  • ltxselement ref"pdelimiter" /gt
  • ltxsany namespace"targetNamespace
    local" minOccurs"0" maxOccurs "unbounded"/gt
  • lt/xssequencegt
  • ltxselement ref"pend" /gt
  • lt/xssequencegt
  • lt/xssequencegt
  • ltfirst-namegtBoblt/first-namegt
  • ltlast-namegtSmithlt/last-namegt
  • ltdelimiter /gt
  • ltmiddle-initialgtJlt/middle-initialgt
  • ltend /gt

21
Using extensibility points with sentries II
  • Pro
  • Constructs in format use same namespace
  • Is backwards and forwards compatible
  • Con
  • Adds complexity to format

22
XSD Techniques Extensibility
  • Using wildcards to create open content models
  • Gaining flexibility from substitution groups and
    abstract elements
  • Runtime polymorphism via xsitype and abstract
    types
  • Using xsredefine to update type definitions

23
General Guidance
  • XML formats should be extensible
  • Corollary Processing model for extensions MUST
    be defined
  • Use the same namespace name for compatible
    versions of the format
  • Favor non-breaking changes wherever possible
  • You can add, but never remove

24
Questions?
Write a Comment
User Comments (0)
About PowerShow.com