Presentation is loading. Please wait.

Presentation is loading. Please wait.

XSD Presented by Kushan Athukorala. 2 Agenda XML Namespaces XML Schema XSD Indicators XSD Data Types XSD Schema References.

Similar presentations


Presentation on theme: "XSD Presented by Kushan Athukorala. 2 Agenda XML Namespaces XML Schema XSD Indicators XSD Data Types XSD Schema References."— Presentation transcript:

1 XSD Presented by Kushan Athukorala

2 2 Agenda XML Namespaces XML Schema XSD Indicators XSD Data Types XSD Schema References

3 3 XML Namespaces XML Namespaces provide a method to avoid element name conflicts This XML carries HTML table information: Apples Bananas This XML carries information about a table (a piece of furniture): African Coffee Table 80 120 If these XML fragments were added together, there would be a name conflict

4 4 Solving the Name Conflict Using a Prefix Apples Bananas African Coffee Table 80 120

5 5 Defining xmlns Attribute Two ways Defining in each child element Apples Bananas African Coffee Table 80 120 Defining in the root element Apples Bananas African Coffee Table 80 120

6 6 XML Schema An XML Schema describes the structure of an XML document XML based alternative to DTD The XML Schema language is also referred to as XML Schema Definition (XSD)

7 7 XML Schema contd. The purpose of an XML Schema is to define the legal building blocks of an XML document, just like a DTD. An XML Schema: defines elements that can appear in a document defines attributes that can appear in a document defines which elements are child elements defines the order of child elements defines the number of child elements defines whether an element is empty or can include text defines data types for elements and attributes defines default and fixed values for elements and attributes

8 8 Simple Types Simple Elements A simple element is an XML element that contains only text It cannot contain any other elements or attributes Defining a Simple Element where xxx is the name of the element and yyy is the data type of the element Default and Fixed Values for Simple Elements All attributes are declared as simple types

9 9 Complex Types A complex element contains other elements and/or attributes. There are four kinds of complex elements: empty elements elements that contain only other elements elements that contain only text elements that contain both other elements and text Lets look at some examples

10 10 Complex Element which is Empty A complex XML element, "product", which is empty

11 11 Complex Element which contains only other elements A complex XML element, "employee", which contains only other elements John Smith

12 12 Complex Element which contains only text A complex XML element, "food", which contains only text Ice cream

13 13 Complex Element which contains both elements and text A complex XML element, "description", which contains both elements and text It happened on 03.03.99....

14 14 How to Define a Complex Element in an XML Schema There are two ways 1. If you use the method described above, only the "employee" element can use the specified complex type.

15 15 2. With this approach, several elements can refer to the same complex type

16 16 XSD Indicators There are seven indicators: Order indicators: All Choice Sequence Occurrence indicators: maxOccurs minOccurs Group indicators: Group name attributeGroup name

17 17 Assignments Assignment1 Build your own xsd examples for each indicator. Make sure not to take examples from Google Create a Test Strategy for your examples with boundary value analysis.

18 18 Data Types XML Schema has a lot of built-in data types. The most common types are: xs:string xs:decimal xs:integer xs:boolean xs:date xs:time Assignment2 – Build your own xsd examples for each Datatype. Make sure not to take examples from Google.

19 19 Schema References Study the following on the web XSD Elements Assignment3 – Explain the operation of two XSD elements other than simpleType and complexType elements with appropriate examples. XSD Restrictions/Facets for Data types Assignment4 – Explain the operation of two constraints with examples.

20 20 Thank You

21 21 USA INDIA SRILANKA UK www.virtusa.com © V I r t u s a C o r p o r a t i o n "Virtusa" is a trademark of the company and a registered trademark in the EU and In India. "Productization" is a service mark of the company and a registered service mark in the United States. "vRule" is a service mark of the company. For more information please contact SalesInquiries@virtusa.com


Download ppt "XSD Presented by Kushan Athukorala. 2 Agenda XML Namespaces XML Schema XSD Indicators XSD Data Types XSD Schema References."

Similar presentations


Ads by Google