1 / 21

XML Data Reduced Schema

XML Data Reduced Schema. Eugenia Fernandez IUPUI. Problems with DTDs. Not expressed in XML syntax – must learn new language Little control over data types Not easily extensible Does not support XML namespaces, thus cannot mix elements from multiple sources. History of XDR.

kana
Download Presentation

XML Data Reduced Schema

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML Data Reduced Schema Eugenia Fernandez IUPUI

  2. Problems with DTDs • Not expressed in XML syntax – must learn new language • Little control over data types • Not easily extensible • Does not support XML namespaces, thus cannot mix elements from multiple sources

  3. History of XDR • Based on a submission to the W3C • Subset of Microsoft’s full XML-Data recommendation • Proposal submitted in January 1998 before XML 1.0 standard was done • Integral part of BizTalk, an XML vocabulary used for e-commerce

  4. XDR Schema • Root element is always Schema • Root element always contains • a name attribute that specifies the name of the schema • an xmlns attribute that specifies the default namespace for the Schema element and its child elements

  5. XDR Schema Element <Schema name="myschema" xmlns="urn:schemas-microsoft.com:xml-data" xmlns:dt="urn:schemas-microsoft.com:datatypes"> ... </Schema>

  6. XDR Element Syntax <ElementType content="{empty | textOnly | eltOnly | mixed}" dt:type="datatype" model="{open | closed}" name="idref" order="{one | seq | many}">

  7. ElementType Content • empty • textOnly • eltOnly • only other elements • mixed • mixed content model

  8. Linking an XDR Schema to an XML Document • Add xmlns attribute to root element <root_element xmlns = x-schema:filename.xdr"> </root_element>

  9. boolean char date dateTime float int number string time fixed.14.4 i1, i2, i4, i8 r4, r8 ui1, ui2, ui4, ui8 uri Element Datatypes For a complete list, go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/xsd_xdrref_5s8j.asp

  10. ElementType Model • Open • can contain other elements & attributes not specified in the schema • Closed • cannot include elements or other content not specified in the schema

  11. ElementType Name • name="idref" • required, • identifies the element

  12. ElementType Order • Establishes the order of the child elements • One • only one element of the set can be included • Seq • elements must appear in the specified sequential order • Many • elements may appear, or not, in any order

  13. Declaring Child Elements • use element tag nested within ElementType tag with name of child element contained in type attribute • a matching ElementType must exist for the child element <ElementType name="parent" model="closed" content="eltonly"> <element type="child"/></ElementType> <ElementType name="child" model="closed" content="textOnly"/>

  14. Declaring Attributes • Add AttributeType element as a child of the element to which the attribute belongs • declares a type of attribute • Pair it with an attribute element • defines an attribute for that particular element

  15. AttributeType Syntax <AttributeType default="default_value" dt:type="primitive-type" dt:values="enumerated-values" name="idref" required="{yes | no}">

  16. entity entities enumeration id idref idrefs nmtoken nmtokens notation string AttributeType dt:types

  17. Attribute Element Syntax overrides any default provided in AttributeType <attribute default="default_value" type="attribute-type" [required="{yes | no}"] > must match name attribute of previously declared AttributeType optional if required attribute used in AttributeType

  18. Occurrence Indicators • via child elements of the element tag • <element type="element-type" [minOccurs="{0 | 1}"] [maxOccurs="{1 | *}"] > optional required only once many times

  19. Attribute Length Constraints • for attributes with dt:type of string or number • via attribute of AttributeType element • dt:minLength="positive-integer" • dt:maxLength="positive-integer"

  20. Content Groups • Establishes constraints on a group of child elements within an ElementType element <group order="{one | seq | many}" minOccurs="{0|1}" maxOccurs="{1|*}" <element type="ElementType"/> <element type="ElementType"/> <element type="ElementType"/> </group>

  21. References • Day 5 in Sams Teach Yourself XML in 21 Days, Second Edition (Sams Publishing, 2001)

More Related