Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Schema Describing the structure of XML documents. A very brief introduction 1XML Schema.

Similar presentations


Presentation on theme: "XML Schema Describing the structure of XML documents. A very brief introduction 1XML Schema."— Presentation transcript:

1 XML Schema Describing the structure of XML documents. A very brief introduction 1XML Schema

2 What is XML Schema? XML schema is used to describe the structure of XML documents – Name of elements + attributes – Sub-elements – Sequence of elements, etc. XML Schema is itself an XML application XSD = XML Schema Definition – Filename.xsd holds an XML Schema XML Schema is a W3C recommendation, 2001 2XML Schema

3 Validation An XML documents can be validated against its XML schema – Check that all element, etc. Of the XML document conforms with the XML schema XML Schema3

4 XML schema, example XML Schema4

5 XML schema support in Visual Studio Ultimate You can generate an XML schema from an XML document – Menu: XML → Create Schema The schema is saved in your home directory. If you want it in your Visual Studio you must 1.Right click the project node 2.Chose” Add Existing Item…” You can validate XML documents as you write them 1.With your XML document, go to the ”Properties” window 2.Select ”Schemas” and press the small ”…” button 3.In Visual Studio it’s not enough to make a link from the XML document to the XML schema file (next slide) XML Schema5

6 Reference to an XML schema from an XML document <students xmlns="http://www.rhs.dk/andersb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.rhs.dk/andersb students.xsd"> Anders Roskilde Bill London XML Schema6

7 XSD simple elements Simple element has no child elements – – Some common types xs:string, xs:decimal, xs:integer xs:boolean xs:date, xs:time User defines types – Restrictions on data types, example: interval XML Schema7

8 XSD complex elements Four kinds of complex elements – empty elements may have attributes – elements that contain only other elements – elements that contain only text – elements that contain both other elements and text Attribute – Child element of – XML Schema8


Download ppt "XML Schema Describing the structure of XML documents. A very brief introduction 1XML Schema."

Similar presentations


Ads by Google