W3C XML Schema
Patterns for Databinding

                Paul Downey, BT
Chair, XML Schema Patterns for Databinding Workin...
XML Schema



    ?
Validation

             XML
            Schema




                         Post
  XML       Schema      Schema
Instance ...
Description
          XML
         Schema




           XML
Sender   Instance
                    Receiver
Types

          xs:string
          xs:int
XML
          tns:Address
          foo:PurchaseOrder
Databinding



    ?
Databinding
    Abstraction


Model        XML
Model
• Java
• Database
• Annotated DOM
• JSON
• PHP serialisation
• XML
• Whatever
Why Describe



    ?
Duck Typing XML



      ?
Force Array

<opt>                     {
    <name>value</name>        name => ‘value’
</opt>                    }



    ...
Static Typing

{
    int accountNo;
    long ammount;
    string name;
}
What’s wrong with
  Databinding



       ?
“State of the Art”

•   reject valid XML Schema documents

•   reject valid XML instance documents

•   content of valid X...
Impedance
 Mismatch

  ><
  OO
Circles, Triangles,
        Rectangles


       XML 2003
http://www.idealliance.org/papers/dx_xml03/papers/06-02-01/06-02-...
I ! Mixed Content

text <O/> text
<O> text </O>
Don’t Databind?
• XSLT
• DOM
• LINQ
• E4X
• XJ
• etc
Abstraction Scale

Objects   Infoset         XML     Bits




      Typed    DOM               Text
      DOM
            ...
They Don’t Like
    XML!
Abstraction



    ?
XML Schema
        is Big ..

• Lot’s of ways to describe the concrete
• Lot’s of ways to represent the abstract
Partial
Implementations

“Our tool doesn’t support xs:foo.
     Change your schema.”

              * vendor
So begins ..



“The Barf Dance”
it’s not so much that
    schema sucks ...
or that databinding tools
         suck ...
it’s that all databinding tools
               suck

        differently
W3C
Working Group



     ?
WS-I


• Basic Profile
• XML Schema Work Plan Working Group
W3C Workshop
XML Schema 1.0 User Experiences
Discussion
Don’t Just Change
    Schema!
       … 300,000+ developers use XSD
       … There is tremendous value in
       XML Schema...
Discussion Topics

•   versioning
•   profiles and patterns of use
•   code generation (v) validation
•   Unique Particle A...
W3C XML Schema
Patterns for Databinding
    Working Group



          !
Deliverables

• W3C Recommendation for Basic Patterns
• W3C Recommendation for Advanced Patterns
• Test Suite
• Mechanism ...
Out of Scope:


• Profile of Schema
• Language Specific Detail
Patterns



   !
AnyURIElement
.//xs:element/@type[resolve-QName(.,..)
        = xs:QName('xs:anyURI')]




<xs:element name=quot;anyURIEle...
ElementMinOccurs0
MaxOccursUnbounded
 .//xs:element[@minOccurs = '0'
       and @maxOccurs = 'unbounded']/
         (@minO...
SequenceSingle
    RepeatedElement
.//xs:sequence[count(xs:element) = 1]/
    xs:element[@maxOccurs = 'unbounded']/
      ...
StringEnumerationType
.//xs:simpleType/xs:restriction[
  @base/resolve-QName(.,..) = xs:QName('xs:string')
    and xs:enum...
SOAP Encoded Array
./xs:complexType[@name]/xs:complexContent/
    xs:restriction[
      @base/resolve-QName(.,..)
        ...
Palatability



    ?
Value Judgement

• xs:any becomes XMLElement
• xs:anyURI becomes String
• xs:decimal becomes String
Examples



   !
ElementMinOccurs0
MaxOccursUnbounded
   <xs:element name=quot;durationListquot; type=quot;ex:DurationListquot; />
   <xs:c...
Example
          Descriptions

•   ComplexTypeSequenceExtension.xsd
•   echoComplexTypeSequenceExtension.xsd
•   echoComp...
Example
               Instances

•   ElementMinOccurs0MaxOccursUnbounded-01.xml

•   echoElementMinOccurs0MaxOccursUnboun...
Test Suite
            Example
           Description




Instance


                         Model
            Toolkit


...
Test
Reports
Patterns Detector



       !
Patterns Detector


 XML                Patterns
Schema
         Detector    (URIs)
Buckets



  !
Basic Patterns

• known to work with “state of the art”
  implementations
• they’re, um, very Basic


      Publishers of ...
TargetNamespace
      .[@targetNamespace]/
                 (., @targetNamespace)



An [XML Schema 1.0] document conformi...
“State of the Art”



       ?
SLIPPERY
 SLOPE
Value Judgement
 • new tools arrive
 • old tools become defunct
 • some tools are very lame
 • we can’t test every tool

“...
Advanced Patterns

• exhibited by real schemata
• they’re, um, not very interoperable


 Developers of Implementations Tak...
Not Advanced



    ?
SLIPPERY
 SLOPE
Value Judgement

• XML Schema is big
• Coverage or Possible to Databind?
• always another Schema

  “Bring out your schema...
Patterns in the
     Wild
Build Your Own
       Bucket

• List Patterns your schemas use
• List Patterns your toolkit supports
• Analyse schemas “in...
Other Topics



    ?
Document
 Conformance

Implementation
 Conformance
WS-I Basic Profile


• Detector works on WSDL 1.1
• Composable with Basic Profile 1.1
Annotations


• Tools Generate them
• Useful for “round tripping”
• No-one is submitting them
Versioning

• Concrete patterns exist
• They’re all Advanced


      XML Schema 1.1 is the answer?
Progress



  ?
Schedule
Participants
•   BT

•   Health Level 7

•   National Association of Convenience Stores (NACS)

•   Origo Services Limited...
We Need Your
   Help!




www.w3.org/2002/ws/databinding
How You Can Help

• Participate in the Working Group
• Encourage your vendor of choice to participate
• Contribute to the ...
Thank you!
Any Questions



            ?
www.w3.org/2002/ws/databinding
XML Schema Patterns for Databinding
XML Schema Patterns for Databinding
XML Schema Patterns for Databinding
Upcoming SlideShare
Loading in …5
×

XML Schema Patterns for Databinding

3,389 views

Published on

http://2006.xmlconference.org/programme/presentations/43.html

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,389
On SlideShare
0
From Embeds
0
Number of Embeds
37
Actions
Shares
0
Downloads
87
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

XML Schema Patterns for Databinding

  1. 1. W3C XML Schema Patterns for Databinding Paul Downey, BT Chair, XML Schema Patterns for Databinding Working Group XML 2006, December 5th 2006
  2. 2. XML Schema ?
  3. 3. Validation XML Schema Post XML Schema Schema Instance Validation Processor Infoset
  4. 4. Description XML Schema XML Sender Instance Receiver
  5. 5. Types xs:string xs:int XML tns:Address foo:PurchaseOrder
  6. 6. Databinding ?
  7. 7. Databinding Abstraction Model XML
  8. 8. Model • Java • Database • Annotated DOM • JSON • PHP serialisation • XML • Whatever
  9. 9. Why Describe ?
  10. 10. Duck Typing XML ?
  11. 11. Force Array <opt> { <name>value</name> name => ‘value’ </opt> } { <opt> name => [ <name>value1</name> ‘value1’, <name>value2</name> ‘value2’ </opt> ] }
  12. 12. Static Typing { int accountNo; long ammount; string name; }
  13. 13. What’s wrong with Databinding ?
  14. 14. “State of the Art” • reject valid XML Schema documents • reject valid XML instance documents • content of valid XML instance documents often unavailable in model
  15. 15. Impedance Mismatch >< OO
  16. 16. Circles, Triangles, Rectangles XML 2003 http://www.idealliance.org/papers/dx_xml03/papers/06-02-01/06-02-01.html
  17. 17. I ! Mixed Content text <O/> text <O> text </O>
  18. 18. Don’t Databind? • XSLT • DOM • LINQ • E4X • XJ • etc
  19. 19. Abstraction Scale Objects Infoset XML Bits Typed DOM Text DOM Templating
  20. 20. They Don’t Like XML!
  21. 21. Abstraction ?
  22. 22. XML Schema is Big .. • Lot’s of ways to describe the concrete • Lot’s of ways to represent the abstract
  23. 23. Partial Implementations “Our tool doesn’t support xs:foo. Change your schema.” * vendor
  24. 24. So begins .. “The Barf Dance”
  25. 25. it’s not so much that schema sucks ...
  26. 26. or that databinding tools suck ...
  27. 27. it’s that all databinding tools suck differently
  28. 28. W3C Working Group ?
  29. 29. WS-I • Basic Profile • XML Schema Work Plan Working Group
  30. 30. W3C Workshop XML Schema 1.0 User Experiences
  31. 31. Discussion
  32. 32. Don’t Just Change Schema! … 300,000+ developers use XSD … There is tremendous value in XML Schema. Don't just change it… Soumitra Sengupta, Microsoft
  33. 33. Discussion Topics • versioning • profiles and patterns of use • code generation (v) validation • Unique Particle Attribution (UPA) • XML Schema 1.1 • test suite
  34. 34. W3C XML Schema Patterns for Databinding Working Group !
  35. 35. Deliverables • W3C Recommendation for Basic Patterns • W3C Recommendation for Advanced Patterns • Test Suite • Mechanism to Detect patterns
  36. 36. Out of Scope: • Profile of Schema • Language Specific Detail
  37. 37. Patterns !
  38. 38. AnyURIElement .//xs:element/@type[resolve-QName(.,..) = xs:QName('xs:anyURI')] <xs:element name=quot;anyURIElementquot; type=quot;xs:anyURIquot; /> http://www.w3.org/2002/ws/databinding/patterns/6/09/AnyURIElement
  39. 39. ElementMinOccurs0 MaxOccursUnbounded .//xs:element[@minOccurs = '0' and @maxOccurs = 'unbounded']/ (@minOccurs, @maxOccurs) http://www.w3.org/2002/ws/databinding/patterns/6/09/ElementMinOccurs0MaxOccursUnbounded
  40. 40. SequenceSingle RepeatedElement .//xs:sequence[count(xs:element) = 1]/ xs:element[@maxOccurs = 'unbounded']/ (., @maxOccurs) Overlapping! http://www.w3.org/2002/ws/databinding/patterns/6/09/SequenceSingleRepeatedElement
  41. 41. StringEnumerationType .//xs:simpleType/xs:restriction[ @base/resolve-QName(.,..) = xs:QName('xs:string') and xs:enumeration]/ (., @base, xs:enumeration/(., @value)) <xs:simpleType name=quot;Beatlequot;> <xs:restriction base=quot;xs:stringquot;> <xs:enumeration value=quot;Johnquot; /> <xs:enumeration value=quot;Paulquot; /> <xs:enumeration value=quot;Georgequot; /> <xs:enumeration value=quot;Ringoquot; /> </xs:restriction> http://www.w3.org/2002/ws/databinding/patterns/6/09/StringEnumerationType
  42. 42. SOAP Encoded Array ./xs:complexType[@name]/xs:complexContent/ xs:restriction[ @base/resolve-QName(.,..) = xs:QName ('soap11enc:Array')]/ xs:attribute[(@ref/resolve-QName(.,..) = xs:QName('soap11enc:arrayType')) and @wsdl11:arrayType]/ (../.., ../(., @base), ., @ref, @wsdl11:arrayType) http://www.w3.org/2002/ws/databinding/patterns/6/09/SOAPEncodedArray
  43. 43. Palatability ?
  44. 44. Value Judgement • xs:any becomes XMLElement • xs:anyURI becomes String • xs:decimal becomes String
  45. 45. Examples !
  46. 46. ElementMinOccurs0 MaxOccursUnbounded <xs:element name=quot;durationListquot; type=quot;ex:DurationListquot; /> <xs:complexType name=quot;DurationListquot;> <xs:sequence> <xs:element name=quot;durationValuequot; type=quot;xs:shortquot; ! ! ! ! ! minOccurs=quot;0quot; maxOccurs=quot;unboundedquot; /> </xs:sequence> </xs:complexType> http://www.w3.org/2002/ws/databinding/examples/6/09/ElementMinOccurs0MaxOccursUnbounded
  47. 47. Example Descriptions • ComplexTypeSequenceExtension.xsd • echoComplexTypeSequenceExtension.xsd • echoComplexTypeSequenceExtension.wsdl • echoComplexTypeSequenceExtension-wsdl20.wsdl
  48. 48. Example Instances • ElementMinOccurs0MaxOccursUnbounded-01.xml • echoElementMinOccurs0MaxOccursUnbounded-01.xml • echoElementMinOccurs0MaxOccursUnbounded-01-soap11.xml • echoElementMinOccurs0MaxOccursUnbounded-01-soap12.xml
  49. 49. Test Suite Example Description Instance Model Toolkit Output
  50. 50. Test Reports
  51. 51. Patterns Detector !
  52. 52. Patterns Detector XML Patterns Schema Detector (URIs)
  53. 53. Buckets !
  54. 54. Basic Patterns • known to work with “state of the art” implementations • they’re, um, very Basic Publishers of Schemas Take Note!
  55. 55. TargetNamespace .[@targetNamespace]/ (., @targetNamespace) An [XML Schema 1.0] document conforming to this specification MUST define a targetNamespace whose value is an absolute URI. † http://www.w3.org/2002/ws/databinding/patterns/6/09/TargetNamespace
  56. 56. “State of the Art” ?
  57. 57. SLIPPERY SLOPE
  58. 58. Value Judgement • new tools arrive • old tools become defunct • some tools are very lame • we can’t test every tool “Bring out your implementations”
  59. 59. Advanced Patterns • exhibited by real schemata • they’re, um, not very interoperable Developers of Implementations Take Note!
  60. 60. Not Advanced ?
  61. 61. SLIPPERY SLOPE
  62. 62. Value Judgement • XML Schema is big • Coverage or Possible to Databind? • always another Schema “Bring out your schemata”
  63. 63. Patterns in the Wild
  64. 64. Build Your Own Bucket • List Patterns your schemas use • List Patterns your toolkit supports • Analyse schemas “in the wild”
  65. 65. Other Topics ?
  66. 66. Document Conformance Implementation Conformance
  67. 67. WS-I Basic Profile • Detector works on WSDL 1.1 • Composable with Basic Profile 1.1
  68. 68. Annotations • Tools Generate them • Useful for “round tripping” • No-one is submitting them
  69. 69. Versioning • Concrete patterns exist • They’re all Advanced XML Schema 1.1 is the answer?
  70. 70. Progress ?
  71. 71. Schedule
  72. 72. Participants • BT • Health Level 7 • National Association of Convenience Stores (NACS) • Origo Services Limited • SAP AG • WSO2 • Invited Expert: Priscilla Walmsley ... and that’s It!
  73. 73. We Need Your Help! www.w3.org/2002/ws/databinding
  74. 74. How You Can Help • Participate in the Working Group • Encourage your vendor of choice to participate • Contribute to the test suite • Contribute your Schemata www.w3.org/2002/ws/databinding
  75. 75. Thank you! Any Questions ? www.w3.org/2002/ws/databinding

×