1 XML Schema Information Retrieval Systems Maria Indrawan 2003
2 Complex Type with Attribute The declaration of attributes need to be placed after the declaration of child elements.
3 ComplexType with Attribute
4 Anonymous Type A type that is defined without a name associated with it. <xs:attribute name="language" type="xs:string" use="required"/>
5 Named Type
6 Named Type John Howard George Bush
7 Derived Data Type Derived data types can be created using an extension or restriction methods. Extension is similar to the concept of generalisation in OO modelling. Restriction is similar to the concept of inheritance in OO modelling.
8 Simple Type Derivation Derivation by Restriction. –use the xs:restriction Derivation by List Derivation by Union
9 Restriction Restriction can be used to: –specify a range. –specify the length of a string. –specify pattern of a string. –etc
10 Restriction – Range
11 Restriction – Range Restriction –Example : height integer 150 to 250 cm
12 Restriction – Enumerated Values
13 Enumerated Values <size xsi:noNamespaceSchemaLocation="enum.xsd" xmlns:xsi=" instance">XL
14 Restriction - Pattern Victorian Number Plate. –3 digits character followed by 3 digits number.
15 Regular Expression A pattern definition language used to perform pattern matching. Characters used in regular expression: –Bound {n} specifies the exact number of times for the preceeding item to match. {n,} specifices the minimum number of times for the preceeding item to match. {n,m} specifies the minimum(n) and the maximum(m) nuber of times for the preceeding item to match. –?, +, *
16 Regular Expression –Bracket [] => Matches one of any character enclosed, eg. [abcd] [lowerBound-upperBound] => Matches any character within the range of lowerBound and upperBound, eg [1-9]. [^] => Matches any character EXCEPT those enclosed, eg [cat] Examples: –“0{0,2}1?5? 0{0,2} => up to two 0s are permitted. 1?=> 0 or 1 occurrence of the number “1” 5?=> 0 or 1 occurrence of the number “5” Correct values: 0015, 1, 5 Incorrect values: 25, 0001
17 Derivation by List Derivation by list is the mechanism by which a list data type can be derived from an atomic data type. All the items in the list need to have the same data type. Example:
18 Derivation by List
19 Derivation by Union Derivation by union allows the definition of a new data type by merging of several predefined or user derived data types.
20 Derivation by Union
21 Derivation by Union (con’t)
22 Derivation by Union (con’t)
23 Derivation of a Complex Type Extension –add child-elements cannot be used in a simple content complex type –add attributes Restriction –removing child-elements or attributes
24 Adding a Child-element
25 Adding an Attribute (1) <!–- Adding an attribute to a simple type to make a complex type
26 Adding an Attribute (2) <!–- adding an attribute to a complex type
27 Removing a Child-Element
28
29 Removing Attribute
30 Global Declaration
31 y y Summary element model group xs:sequencexs:choicexs:all Named Type exist? type=comp lexType y type=“nameType” modify the namedType? primitive dataType? simpleType “type= xs:..” y n modify?restriction y add element/attr ? restriction extension n child element? n n y textNode? y mixed Content n y y textNode? simpleContent attribute(s)? emptyContent n