XML Schemas 1 Useful Links Schema tutorial links

  • Slides: 40
Download presentation
XML Schemas 1

XML Schemas 1

Useful Links • Schema tutorial links: • http: //www. w 3 schools. com/schema/default. asp

Useful Links • Schema tutorial links: • http: //www. w 3 schools. com/schema/default. asp • http: //www. xfront. com/ • http: //www. w 3. org/TR/xmlschema-0/ 2

Why Schemas – Enhanced datatypes • 44+ versus 10 • Can create your own

Why Schemas – Enhanced datatypes • 44+ versus 10 • Can create your own datatypes – Example: "This is a new type based on the string type and elements of this type must follow this pattern: ddddddd, where 'd' represents a digit". – Written in the same syntax as instance documents: less syntax to remember – Can extend or restrict a type (derive new type definitions on the basis of old ones) – Can express sets, i. e. , can define the child elements to occur in any order – Can specify element content as being unique (keys on content) and uniqueness within a region – Can define multiple elements with the same name but different content – Can define substitutable elements - e. g. , the "Book" element is substitutable for the "Publication" element. 3

Schemas and DTDs • One difference between XML Schemas and DTDs is that the

Schemas and DTDs • One difference between XML Schemas and DTDs is that the XML Schema vocabulary is associated with a name (namespace). Likewise, the new vocabulary that you define must be associated with a name (namespace). • With DTDs neither set of vocabulary is associated with a name (namespace). 4

Some XML Parsers with Schema Support • A comparison of some XML parsers: –

Some XML Parsers with Schema Support • A comparison of some XML parsers: – http: //webreference. com/xml/column 22/2. html 5

Example – Book. Catalog. dtd • • <!ELEMENT Book. Catalog (Book)+> <!ELEMENT Book (Title,

Example – Book. Catalog. dtd • • <!ELEMENT Book. Catalog (Book)+> <!ELEMENT Book (Title, Author, Date, ISBN, Publisher)> <!ELEMENT Title (#PCDATA)> <!ELEMENT Author (#PCDATA)> <!ELEMENT Date (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ELEMENT Publisher (#PCDATA)> 6

An Example Of A Schema Definition Book. Catalog. xsd <? xml version="1. 0" encoding="UTF-8"?

An Example Of A Schema Definition Book. Catalog. xsd <? xml version="1. 0" encoding="UTF-8"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: element name="Book. Catalog"> <xsd: complex. Type> <xsd: sequence> <xsd: element ref="Book" min. Occurs="1“ max. Occurs="unbounded"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: element name="Book"> <xsd: complex. Type> <xsd: sequence> <xsd: element ref="Title" min. Occurs="1" max. Occurs="1"/> <xsd: element ref="Author" min. Occurs="1" max. Occurs="1"/> <xsd: element ref="Date" min. Occurs="1" max. Occurs="1"/> <xsd: element ref="ISBN" min. Occurs="1" max. Occurs="1"/> <xsd: element ref="Publisher" min. Occurs="1" max. Occurs="1"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: element name="Title" type="xsd: string"/> <xsd: element name="Author" type="xsd: string"/> <xsd: element name="Date" type="xsd: string"/> <xsd: element name="ISBN" type="xsd: string"/> 7 <xsd: element name="Publisher" type="xsd: string"/>

Book. Catalog. xml <? xml version="1. 0"? > <Book. Catalog xmlns: xsi="http: //www. w

Book. Catalog. xml <? xml version="1. 0"? > <Book. Catalog xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance" xsi: schema. Location="Book. Catalog. xsd"> <Book> <Title>Billions Of Stars</Title> <Author>Susan Boggs</Author> <Date>1983</Date> <ISBN>1 -5555 -2</ISBN> <Publisher>Anderson-Wells</Publisher> </Book> <Title>Adventures Of Freddie the Frog</Title> <Author>John Smith</Author> <Date>1977</Date> <ISBN>0 -4444 -4</ISBN> <Publisher>Kidder Publishing Co. </Publisher> </Book. Catalog> 8

Schema namespace • Schema element: All XML schemas have schema as the root element.

Schema namespace • Schema element: All XML schemas have schema as the root element. • XML Schema namespace: The elements and datatypes that are used to construct schemas, like, schema, element, complex. Type, sequence and string come from the http: //…/XMLSchema namespace 9

Using namespaces Example – plants. xsd <? xml version="1. 0"? > <xsd: schema xmlns:

Using namespaces Example – plants. xsd <? xml version="1. 0"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema" target. Namespace="http: //www. My. Defs. com" xmlns="http: //www. My. Defs. com" element. Form. Default="qualified"> <xsd: element name="plants"> <xsd: complex. Type> <xsd: sequence> <xsd: element ref="plant" min. Occurs="1" max. Occurs="unbounded"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: element name="plant"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="plant. Name" min. Occurs="1" max. Occurs="1"/> <xsd: element name="category" min. Occurs="1" max. Occurs="1"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema> 10

Example – plants. xml <? xml version="1. 0"? > <plants xmlns="http: //www. My. Defs.

Example – plants. xml <? xml version="1. 0"? > <plants xmlns="http: //www. My. Defs. com" xmlns: xsi="http: //www. w 3. org/2001/XMLSchemainstance" xsi: schema. Location=“plants. xsd"> <plant. Name>Daisy</plant. Name> <category>perennial</category> </plants> 11

Example – Book. Catalog. xsd <? xml version="1. 0"? > <schema xmlns="http: //www. w

Example – Book. Catalog. xsd <? xml version="1. 0"? > <schema xmlns="http: //www. w 3. org/2001/XMLSchema" target. Namespace="http: //www. My. Defs. org" xmlns: bk="http: //www. My. Defs. org" element. Form. Default="qualified"> <element name="Book. Catalog"> <complex. Type> <sequence> <element ref="bk: Book" min. Occurs="1" max. Occurs="unbounded"/> </sequence> </complex. Type> </element> <element name="Book"> <complex. Type> <sequence> <element ref="bk: Title"/> … <element ref="bk: Publisher"/> </sequence> </complex. Type> </element> 12

Book. Catalog. xml <? xml version="1. 0"? > <Book. Catalog xmlns="http: //www. My. Defs.

Book. Catalog. xml <? xml version="1. 0"? > <Book. Catalog xmlns="http: //www. My. Defs. org" xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance" xsi: schema. Location="http: //www. My. Defs. org Book. Catalog. xsd"> <Book> <Title>Billions Of Stars</Title> <Author>Susan Boggs</Author> <Date>1983</Date> <ISBN>1 -5555 -2</ISBN> <Publisher>Anderson-Wells</Publisher> </Book> <Title>Adventures Of Freddie the Frog</Title> <Author>John Smith</Author> <Date>1977</Date> <ISBN>0 -4444 -4</ISBN> <Publisher>Kidder Publishing Co. </Publisher> </Book. Catalog> 13

Simple vs Complex Types • A schema document can be divided into content types:

Simple vs Complex Types • A schema document can be divided into content types: Simple and complex types. • Simple types: can contain only text. There are several simple built-in types – String, Boolean, Float, Double, IDREF, Entity etc. – Derived data types: The built-in data types can be customized to control the content. • Complex types: can contain elements that can contain other elements or attributes. • Local vs global declarations: Schema components, elements, attributes, named simple and complex types, declared under xsd: schema element are considered globally declared. A global declaration has to be explicitly referenced. • New elements can be declared within the context of a complex type, in which case they are considered locally declared. 14

Simple Types: example. A. xsd <? xml version="1. 0" encoding="UTF-8"? > <xsd: schema xmlns:

Simple Types: example. A. xsd <? xml version="1. 0" encoding="UTF-8"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: element name="Simple. Types"/> <xsd: element name="title" type="xsd: string"/> <xsd: element name="price" type="xsd: decimal"/> <xsd: element name="last-modified" type="xsd: string"/> <xsd: element name="translated" type="xsd: boolean"/> </xsd: schema> 15

example. A. xml <? xml version="1. 0"? > <Simple. Types xmlns: xsi="http: //www. w

example. A. xml <? xml version="1. 0"? > <Simple. Types xmlns: xsi="http: //www. w 3. org/2001/XMLSchemainstance" xsi: schema. Location="example. A. xsd"> <title>Billions Of Stars</title> <price>2000 -01 -02</price> <last. Modified>1983</last. Modified> <translated>true</translated> </Simple. Types> 16

Deriving From Simple Types • A new custom type can be derived a simple

Deriving From Simple Types • A new custom type can be derived a simple type. • Example: <xsd: simple. Type name="ISBNType"> <xsd: restriction base="xsd: string"> -- refers to a simple type <xsd: pattern value="d{1}-d{5}-d{3}-d{1}"/> </xsd: restriction> </xsd: simple. Type> • Patterns are specified using regular expressions (supports regular expressions from perl) 17

Example – Example 3. xsd and Example 3. xml <? xml version="1. 0" encoding="UTF

Example – Example 3. xsd and Example 3. xml <? xml version="1. 0" encoding="UTF 8"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/X MLSchema"> <xsd: element name="Custom. Types"/> <xsd: simple. Type name="ISBNType"> <xsd: restriction base="xsd: string"> <xsd: pattern value="d{1} -d{5}-d{3}-d{1}"/> </xsd: restriction> </xsd: simple. Type> <? xml version="1. 0"? > <Custom. Types xmlns: xsi="http: //www. w 3. org 2001/XMLSchema-instance" xsi: schema. Location="example. B xsd"> <title>Billions Of Stars</title> <ISBN> 2 -12345 -678 -9 </ISBN> </Custom. Types> <xsd: element name="title" type="xsd: string"/> <xsd: element name="ISBN" type="ISBNType"/> </xsd: schema> 18

Giving a choice of acceptable values <xsd: simple. Type> base="xsd: string"> value="autobiography"/> value="non-fiction"/> value="fiction"/>

Giving a choice of acceptable values <xsd: simple. Type> base="xsd: string"> value="autobiography"/> value="non-fiction"/> value="fiction"/> <xsd: restriction <xsd: enumeration </xsd: restriction> </xsd: simple. Type> 19

Defining Complex Types • Elements that can contain other elements or attributes. • There

Defining Complex Types • Elements that can contain other elements or attributes. • There are four kinds of elements of complex type: – Elements that contain other elements and attributes, but no text. – Elements that are empty – possibly contain attributes but no other elements or text. – Elements of mixed content that can contain a combination of elements, attributes or text. – Elements that contain only text. 20

Example - Elements containing elements only <? xml version="1. 0"? > <xsd: schema xmlns:

Example - Elements containing elements only <? xml version="1. 0"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: element name="Book. Catalog"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Book" max. Occurs="unbounded"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Title" type="xsd: string"/> <xsd: element name="Author" type="xsd: string"/> …. </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema> 21

Example – Elements containing elements only <? xml version="1. 0" encoding="UTF-8"? > <xsd: schema

Example – Elements containing elements only <? xml version="1. 0" encoding="UTF-8"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"> <xsd: element name="plants"> <xsd: complex. Type> <xsd: sequence> <xsd: element ref="plant" min. Occurs="1" max. Occurs="unbounded"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: element name="plant"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="plant. Name" min. Occurs="1" max. Occurs="1"/> <xsd: element name="category" min. Occurs="1" max. Occurs="1"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: schema> 22

Referring to a group If we want to reuse a set of elements in

Referring to a group If we want to reuse a set of elements in several content –type definitions, we can use a model group to define a set of elements that can be repeated. They act rather like parameter entities in DTDs. A model group consists of element declarations, wildcards and other model groups. The minimum values for min and max. Occurences = 1. <xsd: element name="Book" max. Occurs="unbounded"> <xsd: complex. Type> <xsd: sequence> <xsd: group ref="Book. Elements"/> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: group name="Book. Elements"> <xsd: sequence> <xsd: element name="Title" type="xsd: string"/> <xsd: element name="Author" type="xsd: string" max. Occurs="unbounded"/> <xsd: element name="Date" type="xsd: string"/> <xsd: element name="ISBN" type="xsd: string"/> <xsd: element name="Publisher" type="xsd: string"/> </xsd: sequence> </xsd: group> 23

Using all <xsd: element name="Book" max. Occurs="unbounded"> <xsd: complex. Type> <xsd: all> <xsd: element

Using all <xsd: element name="Book" max. Occurs="unbounded"> <xsd: complex. Type> <xsd: all> <xsd: element name="Title" type="xsd: string"/> <xsd: element name="Author" type="xsd: string"/> <xsd: element name="Date" type="xsd: string"/> <xsd: element name="ISBN" type="xsd: string"/> <xsd: element name="Publisher" type="xsd: string"/> </xsd: all> </xsd: complex. Type> </xsd: element> <? xml version="1. 0"? > <Book> <Title>Billions Of Stars</Title> <Author>Susan Boggs</Author> <Date>1983</Date> <ISBN>1 -5555 -2</ISBN> <Publisher>Anderson. Wells</Publisher> </Book> <Title>Adventures Of Freddie the Frog</Title> <Author>John Smith</Author> <Date>1977</Date> <ISBN>0 -4444 -4</ISBN> <Publisher>Kidder Publishing 24 Co. </Publisher> </Book>

Attributes • Attribute declarations: – An attribute is declared with <attribute>. – An attribute

Attributes • Attribute declarations: – An attribute is declared with <attribute>. – An attribute can be defined outside of a complex type and referenced in complex type. – Attribute types can be defined using primitive types. – Default, fixed, optional, required and prohibited can be used to set the values for attributes. – Example: – <attribute name=widget. Price” type=“xsd: float” value=“ 10. 00” use=“required” /> 25

<!ELEMENT Book. Catalog(Book)+> <!ELEMENT Book (Title, Author+, Date, ISBN, Publisher)> <!ATTLIST Book Category (autobiography

<!ELEMENT Book. Catalog(Book)+> <!ELEMENT Book (Title, Author+, Date, ISBN, Publisher)> <!ATTLIST Book Category (autobiography | non-fiction | fiction) #REQUIRED In. Stock (true | false) "false" Reviewer CDATA " "> <!ELEMENT Title (#PCDATA)> <!ELEMENT Author (#PCDATA)> <!ELEMENT Date (#PCDATA)> <!ELEMENT ISBN (#PCDATA)> <!ELEMENT Publisher (#PCDATA)> <!ELEMENT Month (#PCDATA)> <!ELEMENT Year (#PCDATA)> 26

xsd: element name="Book. Catalog"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Book" max. Occurs="unbounded">

xsd: element name="Book. Catalog"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Book" max. Occurs="unbounded"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Title" type="xsd: string"/> <xsd: element name="Author" type="xsd: string" max. Occurs="unbounded"/> <xsd: element name="Publisher" type="xsd: string"/> </xsd: sequence> <xsd: attribute. Group ref="Book. Attributes"/> </xsd: complex. Type> </xsd: element> </xsd: sequence> </xsd: complex. Type> </xsd: element> <xsd: attribute. Group name="Book. Attributes"> <xsd: attribute name="Category" use="required"> <xsd: simple. Type> <xsd: restriction base="xsd: string"> <xsd: enumeration value="autobiography"/> <xsd: enumeration value="non-fiction"/> <xsd: enumeration value="fiction"/> </xsd: restriction> </xsd: simple. Type> </xsd: attribute> <xsd: attribute name="In. Stock" type="xsd: boolean" default="false"/> <xsd: attribute name="Reviewer" type="xsd: string" default="none"/> </xsd: attribute. Group> </xsd: schema> < 27

Uniqueness & Keys • • DTDs provide the ID attribute datatype for uniqueness (i.

Uniqueness & Keys • • DTDs provide the ID attribute datatype for uniqueness (i. e. , an ID value must be unique throughout the entire document, and the XML parser enforces this). XML Schema has much enhanced uniqueness capabilities: – enables you to define element content to be unique. – enables you to define non-ID attributes to be unique. – enables you to define a combination of element content and attributes to be unique. – enables you to distinguish between unique versus key. – enables you to declare the range of the document over which something is unique 28

unique vs key • Key: an element or attribute (or combination thereof) which is

unique vs key • Key: an element or attribute (or combination thereof) which is defined to be a key must: – always be present (min. Occurs must be greater than zero) – be not-false. – be unique • Key implies unique, but unique does not imply key 29

Using ISBN as a Key • In the next example, we will use a

Using ISBN as a Key • In the next example, we will use a Book's ISBN element as a key. 30

Example <? xml version="1. 0"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"

Example <? xml version="1. 0"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema" target. Namespace="http: //www. My. Defs. com" xmlns="http: //www. my. Defs. com" xmlns: bk="http: //www. My. Defs. com" element. Form. Default="qualified"> <xsd: element name="Book. Catalog"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Book" max. Occurs="unbounded"> <xsd: complex. Type> < xsd: sequence> < xsd: element name="Title" type="xsd: string"/> < xsd: element name="Author" type="xsd: string"/> < xsd: element name="Date" type="xsd: string"/> < xsd: element name="ISBN" type="xsd: string"/> < xsd: element name="Publisher" type=" xsd: string"/> </ xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: sequence> </xsd: complex. Type> <!-- Within <Book. Catalog> define a key, called PK. Select each <Book>, and within each <Book> the ISBN element is a key. “ <xsd: key name="PK"> <xsd: selector xpath="bk: Book"/> <xsd: field xpath="bk: ISBN"/> </xsd: key> </xsd: element> </xsd: schema> 31

Book. Catalog. xml <? xml version="1. 0"? > <Book. Catalog xmlns="http: //www. My. Defs.

Book. Catalog. xml <? xml version="1. 0"? > <Book. Catalog xmlns="http: //www. My. Defs. com" xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance" xsi: schema. Location= "http: //www. My. Defs. com Book. Catalog. xsd"> <Book> <Title>Billions Of Stars</Title> <Author>Susan Boggs</Author> <Date>1983</Date> <ISBN>1 -5555 -2</ISBN> <Publisher>Anderson-Wells</Publisher> </Book> <Title>Adventures Of Freddie the Frog</Title> <Author>John Smith</Author> <Date>1977</Date> <ISBN>0 -4444 -4</ISBN> <Publisher>Kidder Publishing Co. </Publisher> </Book. Catalog> 32

Notes about <key> • It must be nested within an <element> • It must

Notes about <key> • It must be nested within an <element> • It must come at the end of <element> (after the content model, and attribute declarations) • Use the <selector> element as a child of <key> to select a set of elements for which the key applies. • Use the <field> element as a child of <key> to identify the element or attribute that is to be the key – There can be multiple <field> elements. 33

Example – meeting. xsd <xsd: element name="meeting"> <xsd: complex. Type> <xsd: sequence> <xsd: element

Example – meeting. xsd <xsd: element name="meeting"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="participants"> <xsd: complex. Type> < xsd: sequence> < xsd: element name="Name" min. Occurs="0" max. Occurs="unbounded"> < xsd: complex. Type> < xsd: sequence> < xsd: element name="First" type="xsd: string"/> < xsd: element name="Last" type="xsd: string"/> </ xsd: sequence> </ xsd: complex. Type> </ xsd: element> </ xsd: sequence> </xsd: complex. Type> </xsd: element> </xsd: sequence> </xsd: complex. Type> <!-- The key is the combination of the First and Last name. < xsd: key name="PK"> <xsd: selector xpath="meet: participants/meet: Name"/> <xsd: field xpath="meet: First"/> <xsd: field xpath="meet: Last"/> </xsd: key> </xsd: element> 34

Example-meeting. xml <? xml version="1. 0"? > <meeting xmlns="http: //www. My. Defs. com" xmlns:

Example-meeting. xml <? xml version="1. 0"? > <meeting xmlns="http: //www. My. Defs. com" xmlns: xsi="http: //www. w 3. org/2001/XMLSchemainstance" xsi: schema. Location="http: //www. My. Defs. com Meeting. xsd"> <participants> <Name><First>John</First><Last>Smith</Last></Name> <Name><First>Mary</First><Last>Jones</Last></Name> </participants> </meeting> 35

unique • The <unique> element is used exactly like the <key> element is used.

unique • The <unique> element is used exactly like the <key> element is used. It has a <selector> and one or more <field> elements, just like <key> has. • The only difference is that the schema validator will simply validate that, whenever present, the values are unique. 36

Example <? xml version="1. 0"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema"

Example <? xml version="1. 0"? > <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema" target. Namespace="http: //www. My. Defs. com" xmlns="http: //www. my. Defs. com" xmlns: bk="http: //www. My. Defs. com" element. Form. Default="qualified"> <xsd: element name="Book. Catalog"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="Book" max. Occurs="unbounded"> …. </xsd: complex. Type> <!– ISBN are unique <xsd: unique name="UNIQ"> <xsd: selector xpath="bk: Book"/> <xsd: field xpath="bk: ISBN"/> </xsd: unique> </xsd: element> </xsd: schema> 37

Referencing a key with a key ref • Similar to ID/IDREFS, you can define

Referencing a key with a key ref • Similar to ID/IDREFS, you can define a keyref to link an element with a key. • If there are 2 fields in the key, then there must be 2 fields in the keyref, if there are 3 fields in the key, then there must be 3 fields in the keyref, etc. • Further, the fields in the keyref must match in type and position to the key. 38

Example – key. Ref. xsd <xsd: element name="root. Element"> <xsd: complex. Type> <xsd: sequence>

Example – key. Ref. xsd <xsd: element name="root. Element"> <xsd: complex. Type> <xsd: sequence> <xsd: element name="element. One" max. Occurs="unbounded"> <xsd: complex. Type> <xsd: attribute name="element. One. Key" type="xsd: integer" /> <xsd: attribute name="element. One. Desc" type="xsd: string" /> </xsd: complex. Type> <xsd: key name="element. One. PK"> <xsd: selector xpath=". //element. One"/> <xsd: field xpath="@element. One. Key"/> </xsd: key> </xsd: element> <xsd: element name="element. Two" max. Occurs="unbounded"> <xsd: complex. Type> <xsd: attribute name="element. Two. Key" type="xsd: integer" /> <xsd: attribute name="element. One. Key" type="xsd: integer" /> <xsd: attribute name="element. Two. Desc" type="xsd: string" /> </xsd: complex. Type> <xsd: keyref name="element. One. FK" refer="element. One. PK"> <xsd: selector xpath=". //element. Two"/> <xsd: field xpath="@element. One. Key"/> </xsd: keyref> </xsd: element> </xsd: sequence> </xsd: complex. Type> </xsd: element> 39

Example – key. Ref. xml <? xml version="1. 0"? > <root. Element xmlns: xsi="http:

Example – key. Ref. xml <? xml version="1. 0"? > <root. Element xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance" xsi: schema. Location="Keyref. xsd"> <element. One. Key="11" element. One. Desc="Some"/> <element. One. Key="12" element. One. Desc="Other"/> <element. Two. Key="99" element. One. Key="11" element. Two. Desc="Refers To Some"/> <element. Two. Key="100" element. One. Key="12" element. Two. Desc="Refers To Other"/> </root. Element> 40