cis562f10_note6_XMLBasics2

cis562f10_note6_XMLBasics2 - * Simple types a type that...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 * Simple types — a type that cannot have elements or carry attributes, i.e., no named subcomponents. o Built-in simple types: string, integer, Built in simple types: string, integer, decimal, Boolean, time, date, etc. (44 built- in types, 19 of them are primitives and 25 are derived). o User-defined (derived) simple types Restriction 3 methods List Union Restriction types — The legal range of values for the new type is a subset of the range of values of an existing type existing type. E.g., restriction type: <xsd:simpleType name="myInteger"> <xsd:restriction base="xsd:integer"> <xsd:minInclusive value="10000"/> <xsd:maxInclusive value="99999"/> facets <xsd:maxInclusive value= 99999 /> </xsd:restriction> </xsd:simpleType>
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 facet E.g., restriction type: <xsd:simpleType name="SKU"> <xsd:restriction base="xsd:string"> <xsd:pattern value="\d{3}-[A-Z]{2}"/> </xsd:restriction> </xsd:simpleType> — "\d{3}-[A-Z]{2}" is a regular expression: “3 digitals fl l db h h fl l db t followed by a hyphen followed by two upper-case letters”. facets E.g., restriction type: <xsd:simpleType name="USState"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="AK"/> <xsd:enumeration value "AL"/> <xsd:enumeration value="AL"/> <xsd:enumeration value="AR"/> <!-- and so on . .. --> </xsd:restriction> </xsd:simpleType> List types — The new type has a sequence of values of an atomic (indivisible) type.
Background image of page 2
3 E.g., list type: <xsd:simpleType name="listOfMyIntType"> <xsd:list itemType="myInteger"/> </xsd:simpleType> list Instance: <listOfMyInt>20003 15037 95977 95945</listOfMyInt> E.g., list type: <xsd:simpleType name="USStateList"> <xsd:list itemType="USState"/> </ d i l T > </xsd:simpleType> <xsd:simpleType name="SixUSStates"> <xsd:restriction base="USStateList"> <xsd:length value="6"/> </xsd:restriction> </xsd:simpleType> facet list Instance: <sixStates>PA NY CA NY LA AK</sixStates>
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 List of types Union types The new type has a value of one type drawn from the union of multiple atomic and list types. E.g., union type: <xsd:simpleType name="zipUnion"> <xsd:union memberTypes="USState listOfMyIntType"/> </xsd:simpleType> union Instance union Instance: <zips>CA</zips> <zips>95630 95977 95945</zips> <zips>AK</zips> * Complex types — Typically contain a set of element declarations, element references and attribute declarations. o Examples E.g., complex type: <xsd:complexType name="USAddress" > <xsd:sequence> <xsd:element name="name" type="xsd:string"/> <xsd:element name="street" type="xsd:string"/> <xsd:element name="city" type="xsd:string"/> <xsd:element name="state" type="xsd:string"/> <xsd:element name="zip" type="xsd:decimal"/> </xsd:sequence> <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/> </xsd:complexType>
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/07/2011 for the course CIS 550 taught by Professor Yoon,d during the Spring '08 term at University of Michigan-Dearborn.

Page1 / 14

cis562f10_note6_XMLBasics2 - * Simple types a type that...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online