SlideShare a Scribd company logo
XSD
An XML Schema describes the structure of an XML document.
In this tutorial you will learn how to create XML Schemas, why XML Schemas
are more powerful than DTDs, and how to use XML Schema in your
application.
Introduction to XML Schema
XML Schema is an XML-based alternative to DTD.
An XML schema describes the structure of an XML document.
The XML Schema language is also referred to as XML Schema Definition
(XSD).
What is an XML Schema?
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
XML Schemas are the Successors of DTDs
We think that very soon XML Schemas will be used in most Web applications
as a replacement for DTDs. Here are some reasons:
• XML Schemas are extensible to future additions
• XML Schemas are richer and more powerful than DTDs
• XML Schemas are written in XML
• XML Schemas support data types
• XML Schemas support namespaces
XML Schemas use XML Syntax
Another great strength about XML Schemas is that they are written in XML.
Some benefits of that XML Schemas are written in XML:
• You don't have to learn a new language
• You can use your XML editor to edit your Schema files
• You can use your XML parser to parse your Schema files
• You can manipulate your Schema with the XML DOM
• You can transform your Schema with XSLT.
A Simple XML Document
Look at this simple XML document called "note.xml":
<? xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
A DTD File
The following example is a DTD file called "note.dtd" that defines the
elements of the XML document above ("note.xml"):
<!ELEMENT note (to, from, heading, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
An XML Schema
The following example is an XML Schema file called "note.xsd" that defines
the elements of the XML document above ("note.xml"):
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Defining a Simple Element
The syntax for defining a simple element is:
<xs:element name="xxx" type="yyy"/>
where xxx is the name of the element and yyy is the data type of the
element.
XSD Elements
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
Example
Here are some XML elements:
<lastname>John</lastname>
<age>36</age>
<dateborn>1970-03-27</dateborn>
And here are the corresponding simple element definitions:
<xs:element name="lastname" type="xs:string"/>
<xs:element name="age" type="xs:integer"/>
<xs:element name="dateborn" type="xs:date"/>
How to Define a Complex Element
Look at this complex XML element, "employee", which contains only other
elements:
<employee>
<firstname>John</firstname>
<lastname>Smith</lastname>
</employee>
We can define a complex element in an XML Schema two different ways:
1. The "employee" element can be declared directly by naming the element,
like this:
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<letter>
<name>John Smith</name>
<orderid>1032</orderid>
<shipdate>2001-07-13</shipdate>
</letter>
The following schema declares the "letter" element:
<xs:element name="letter">
<xs:complexType >
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="orderid" type="xs: Integer"/>
<xs:element name="shipdate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Occurrence Indicators
Occurrence indicators are used to define how often an element can occur.
Note: For all "Order" and "Group" indicators (any, all, choice, sequence,
group name, and group reference) the default value for maxOccurs and
minOccurs is 1.
maxOccurs Indicator
The <maxOccurs> indicator specifies the maximum number of times an
element can occur:
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="full_name" type="xs:string"/>
<xs:element name="child_name" type="xs:string" maxOccurs="10"/>
</xs:sequence>
</xs:complexType>
</xs:element>
The example above indicates that the "child_name" element can occur a
minimum of one time (the default value for minOccurs is 1) and a maximum
of ten times in the "person" element.
minOccurs Indicator
The <minOccurs> indicator specifies the minimum number of times an
element can occur:
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="full_name" type="xs:string"/>
<xs:element name="child_name" type="xs:string"
maxOccurs="10" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Complete Example with Indicators
An XML Document
Let's have a look at this XML document called "Item.xml":
XML
<item>
<title>Empire</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
XSD
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>

More Related Content

What's hot

fundamentals of XML
fundamentals of XMLfundamentals of XML
fundamentals of XML
hamsa nandhini
 
Xml schema
Xml schemaXml schema
Xml schema
sana mateen
 
Xml intro1
Xml intro1Xml intro1
Publishing xml
Publishing xmlPublishing xml
Publishing xml
Kumar
 
XSD
XSDXSD
XML Technologies
XML TechnologiesXML Technologies
XML Technologies
hamsa nandhini
 
Xml presentation
Xml presentationXml presentation
Xml presentation
Miguel Angel Teheran Garcia
 
Xml
XmlXml
Xml schema
Xml schemaXml schema
Xml schema
Prabhakaran V M
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
Baskarkncet
 
XML Schema
XML SchemaXML Schema
XML Schema
yht4ever
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
Umar Ali
 
00 introduction
00 introduction00 introduction
00 introduction
Baskarkncet
 
XML
XMLXML

What's hot (19)

XML Schemas
XML SchemasXML Schemas
XML Schemas
 
fundamentals of XML
fundamentals of XMLfundamentals of XML
fundamentals of XML
 
Xml schema
Xml schemaXml schema
Xml schema
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Xml
Xml Xml
Xml
 
Publishing xml
Publishing xmlPublishing xml
Publishing xml
 
XSD
XSDXSD
XSD
 
XML Technologies
XML TechnologiesXML Technologies
XML Technologies
 
Xml
Xml Xml
Xml
 
Xml
XmlXml
Xml
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Xml
XmlXml
Xml
 
Xml schema
Xml schemaXml schema
Xml schema
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
 
XML Schema
XML SchemaXML Schema
XML Schema
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
 
00 introduction
00 introduction00 introduction
00 introduction
 
XML
XMLXML
XML
 

Viewers also liked

Configuración Oracle Service Bus - Mq
Configuración Oracle Service Bus - MqConfiguración Oracle Service Bus - Mq
Configuración Oracle Service Bus - Mq
Pocho Costa
 
Enterprise managerclodcontrolinstallconfiguration emc12c
Enterprise managerclodcontrolinstallconfiguration emc12cEnterprise managerclodcontrolinstallconfiguration emc12c
Enterprise managerclodcontrolinstallconfiguration emc12c
Rakesh Gujjarlapudi
 
Database adapter
Database adapterDatabase adapter
Database adapter
prathap kumar
 
Exceptionhandling4remote fault
Exceptionhandling4remote faultExceptionhandling4remote fault
Exceptionhandling4remote fault
prathap kumar
 
Dvm
DvmDvm
Mediator-ORACLE SOA
Mediator-ORACLE SOAMediator-ORACLE SOA
Mediator-ORACLE SOA
prathap kumar
 
Oracle OSB Tutorial 3
Oracle OSB Tutorial 3Oracle OSB Tutorial 3
Oracle OSB Tutorial 3
Rakesh Gujjarlapudi
 
Xml material
Xml materialXml material
Xml material
prathap kumar
 
SOA OSB suite cluster installation
SOA OSB suite cluster installationSOA OSB suite cluster installation
SOA OSB suite cluster installation
Rakesh Gujjarlapudi
 
Oracle OSB Tutorial 2
Oracle OSB Tutorial 2Oracle OSB Tutorial 2
Oracle OSB Tutorial 2
Rakesh Gujjarlapudi
 
Osb developer's guide
Osb developer's guideOsb developer's guide
Osb developer's guideHarish B
 
Lesson1 - SOA Governance Overview
Lesson1  - SOA Governance OverviewLesson1  - SOA Governance Overview
Lesson1 - SOA Governance Overview
Rakesh Gujjarlapudi
 
Oracle API Gateway Installation
Oracle API Gateway InstallationOracle API Gateway Installation
Oracle API Gateway Installation
Rakesh Gujjarlapudi
 
Osb student guide
Osb student guideOsb student guide
Osb student guide
Vibhor Rastogi
 
Oracle OSB Tutorial 1
Oracle OSB Tutorial 1Oracle OSB Tutorial 1
Oracle OSB Tutorial 1
Rakesh Gujjarlapudi
 
Oracle Service Bus (OSB) for the Busy IT Professonial
Oracle Service Bus (OSB) for the Busy IT Professonial Oracle Service Bus (OSB) for the Busy IT Professonial
Oracle Service Bus (OSB) for the Busy IT Professonial
Frank Munz
 
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Guido Schmutz
 
Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Rakesh Gujjarlapudi
 

Viewers also liked (20)

Configuración Oracle Service Bus - Mq
Configuración Oracle Service Bus - MqConfiguración Oracle Service Bus - Mq
Configuración Oracle Service Bus - Mq
 
Enterprise managerclodcontrolinstallconfiguration emc12c
Enterprise managerclodcontrolinstallconfiguration emc12cEnterprise managerclodcontrolinstallconfiguration emc12c
Enterprise managerclodcontrolinstallconfiguration emc12c
 
Database adapter
Database adapterDatabase adapter
Database adapter
 
Exceptionhandling4remote fault
Exceptionhandling4remote faultExceptionhandling4remote fault
Exceptionhandling4remote fault
 
Dvm
DvmDvm
Dvm
 
Mediator-ORACLE SOA
Mediator-ORACLE SOAMediator-ORACLE SOA
Mediator-ORACLE SOA
 
Oracle OSB Tutorial 3
Oracle OSB Tutorial 3Oracle OSB Tutorial 3
Oracle OSB Tutorial 3
 
Xml material
Xml materialXml material
Xml material
 
SOA OSB suite cluster installation
SOA OSB suite cluster installationSOA OSB suite cluster installation
SOA OSB suite cluster installation
 
Oracle OSB Tutorial 2
Oracle OSB Tutorial 2Oracle OSB Tutorial 2
Oracle OSB Tutorial 2
 
Osb developer's guide
Osb developer's guideOsb developer's guide
Osb developer's guide
 
Lesson1 - SOA Governance Overview
Lesson1  - SOA Governance OverviewLesson1  - SOA Governance Overview
Lesson1 - SOA Governance Overview
 
Oracle API Gateway Installation
Oracle API Gateway InstallationOracle API Gateway Installation
Oracle API Gateway Installation
 
Xslt
XsltXslt
Xslt
 
Osb student guide
Osb student guideOsb student guide
Osb student guide
 
oracle service bus
oracle service busoracle service bus
oracle service bus
 
Oracle OSB Tutorial 1
Oracle OSB Tutorial 1Oracle OSB Tutorial 1
Oracle OSB Tutorial 1
 
Oracle Service Bus (OSB) for the Busy IT Professonial
Oracle Service Bus (OSB) for the Busy IT Professonial Oracle Service Bus (OSB) for the Busy IT Professonial
Oracle Service Bus (OSB) for the Busy IT Professonial
 
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
Oracle SOA Suite 11g Mediator vs. Oracle Service Bus (OSB)
 
Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1Oracle fusionmiddlewarecontinuosintegration slideshare_v1
Oracle fusionmiddlewarecontinuosintegration slideshare_v1
 

Similar to Xsd

Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
Swati Parmar
 
XSD Incomplete Overview Draft
XSD Incomplete Overview DraftXSD Incomplete Overview Draft
XSD Incomplete Overview Draft
Pedro De Almeida
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
Pradeep Rapolu
 
Xml schema
Xml schemaXml schema
Xml schema
Dr.Saranya K.G
 
distributed system concerned lab sessions
distributed system concerned lab sessionsdistributed system concerned lab sessions
distributed system concerned lab sessions
milkesa13
 
XML Schema.pdf
XML Schema.pdfXML Schema.pdf
XML Schema.pdf
KGSCSEPSGCT
 
XML Fundamentals
XML FundamentalsXML Fundamentals
Web Service Workshop - 3 days
Web Service Workshop - 3 daysWeb Service Workshop - 3 days
Web Service Workshop - 3 days
David Ionut
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
University of Connecticut Libraries
 
Xml 2
Xml  2 Xml  2
Basics of XML
Basics of XMLBasics of XML
Basics of XML
indiangarg
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
AmarYa2
 
Full xml
Full xmlFull xml
advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
IreneGetzi
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
manochitra10
 
XML1.pptx
XML1.pptxXML1.pptx
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
Ranjeet Reddy
 

Similar to Xsd (20)

Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
XSD Incomplete Overview Draft
XSD Incomplete Overview DraftXSD Incomplete Overview Draft
XSD Incomplete Overview Draft
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
Xml schema
Xml schemaXml schema
Xml schema
 
distributed system concerned lab sessions
distributed system concerned lab sessionsdistributed system concerned lab sessions
distributed system concerned lab sessions
 
XML Schema.pdf
XML Schema.pdfXML Schema.pdf
XML Schema.pdf
 
paper about xml
paper about xmlpaper about xml
paper about xml
 
XML Fundamentals
XML FundamentalsXML Fundamentals
XML Fundamentals
 
Web Service Workshop - 3 days
Web Service Workshop - 3 daysWeb Service Workshop - 3 days
Web Service Workshop - 3 days
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
 
Xml 2
Xml  2 Xml  2
Xml 2
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
XML
XMLXML
XML
 
XML
XMLXML
XML
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
 
Full xml
Full xmlFull xml
Full xml
 
advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 
XML1.pptx
XML1.pptxXML1.pptx
XML1.pptx
 
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
 

More from prathap kumar

Xml material
Xml materialXml material
Xml material
prathap kumar
 
Xsd Basics R&D with ORACLE SOA
Xsd Basics R&D with ORACLE SOAXsd Basics R&D with ORACLE SOA
Xsd Basics R&D with ORACLE SOA
prathap kumar
 
E13882== ORACLE SOA COOK BOOK
E13882== ORACLE SOA COOK BOOKE13882== ORACLE SOA COOK BOOK
E13882== ORACLE SOA COOK BOOK
prathap kumar
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
prathap kumar
 
While R&D WITH ORACLE SOA
While R&D WITH ORACLE SOAWhile R&D WITH ORACLE SOA
While R&D WITH ORACLE SOA
prathap kumar
 
Synch calling asynchadd
Synch calling asynchaddSynch calling asynchadd
Synch calling asynchadd
prathap kumar
 
Stored procedure
Stored procedureStored procedure
Stored procedure
prathap kumar
 
Manual device+settings ORACLE SOA
Manual device+settings ORACLE SOAManual device+settings ORACLE SOA
Manual device+settings ORACLE SOA
prathap kumar
 
Jndicreation of database adapter
Jndicreation of database adapterJndicreation of database adapter
Jndicreation of database adapter
prathap kumar
 
Humantask MAKE EASY DUDE
Humantask  MAKE EASY DUDEHumantask  MAKE EASY DUDE
Humantask MAKE EASY DUDE
prathap kumar
 
File2db
File2dbFile2db
File2db
prathap kumar
 
whileloop
whileloopwhileloop
whileloop
prathap kumar
 
Compensation
CompensationCompensation
Compensation
prathap kumar
 
Bam
BamBam
Creating project in j developer
Creating project in j developerCreating project in j developer
Creating project in j developerprathap kumar
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuning
prathap kumar
 
Xavier technology adapters
Xavier technology adaptersXavier technology adapters
Xavier technology adaptersprathap kumar
 

More from prathap kumar (20)

E10132
E10132E10132
E10132
 
Oracle sql material
Oracle sql materialOracle sql material
Oracle sql material
 
Xml material
Xml materialXml material
Xml material
 
Xsd Basics R&D with ORACLE SOA
Xsd Basics R&D with ORACLE SOAXsd Basics R&D with ORACLE SOA
Xsd Basics R&D with ORACLE SOA
 
E13882== ORACLE SOA COOK BOOK
E13882== ORACLE SOA COOK BOOKE13882== ORACLE SOA COOK BOOK
E13882== ORACLE SOA COOK BOOK
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
While R&D WITH ORACLE SOA
While R&D WITH ORACLE SOAWhile R&D WITH ORACLE SOA
While R&D WITH ORACLE SOA
 
Synch calling asynchadd
Synch calling asynchaddSynch calling asynchadd
Synch calling asynchadd
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
Manual device+settings ORACLE SOA
Manual device+settings ORACLE SOAManual device+settings ORACLE SOA
Manual device+settings ORACLE SOA
 
Jndicreation of database adapter
Jndicreation of database adapterJndicreation of database adapter
Jndicreation of database adapter
 
Humantask MAKE EASY DUDE
Humantask  MAKE EASY DUDEHumantask  MAKE EASY DUDE
Humantask MAKE EASY DUDE
 
File2db
File2dbFile2db
File2db
 
whileloop
whileloopwhileloop
whileloop
 
Compensation
CompensationCompensation
Compensation
 
Bam
BamBam
Bam
 
Creating project in j developer
Creating project in j developerCreating project in j developer
Creating project in j developer
 
weblogic perfomence tuning
weblogic perfomence tuningweblogic perfomence tuning
weblogic perfomence tuning
 
java
javajava
java
 
Xavier technology adapters
Xavier technology adaptersXavier technology adapters
Xavier technology adapters
 

Recently uploaded

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 

Recently uploaded (20)

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 

Xsd

  • 1. XSD An XML Schema describes the structure of an XML document. In this tutorial you will learn how to create XML Schemas, why XML Schemas are more powerful than DTDs, and how to use XML Schema in your application. Introduction to XML Schema XML Schema is an XML-based alternative to DTD. An XML schema describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition (XSD). What is an XML Schema? 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 XML Schemas are the Successors of DTDs We think that very soon XML Schemas will be used in most Web applications as a replacement for DTDs. Here are some reasons: • XML Schemas are extensible to future additions • XML Schemas are richer and more powerful than DTDs
  • 2. • XML Schemas are written in XML • XML Schemas support data types • XML Schemas support namespaces XML Schemas use XML Syntax Another great strength about XML Schemas is that they are written in XML. Some benefits of that XML Schemas are written in XML: • You don't have to learn a new language • You can use your XML editor to edit your Schema files • You can use your XML parser to parse your Schema files • You can manipulate your Schema with the XML DOM • You can transform your Schema with XSLT. A Simple XML Document Look at this simple XML document called "note.xml": <? xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> A DTD File The following example is a DTD file called "note.dtd" that defines the elements of the XML document above ("note.xml"): <!ELEMENT note (to, from, heading, body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)>
  • 3. <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> An XML Schema The following example is an XML Schema file called "note.xsd" that defines the elements of the XML document above ("note.xml"): <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Defining a Simple Element The syntax for defining a simple element is: <xs:element name="xxx" type="yyy"/>
  • 4. where xxx is the name of the element and yyy is the data type of the element. XSD Elements 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 Example Here are some XML elements: <lastname>John</lastname> <age>36</age> <dateborn>1970-03-27</dateborn> And here are the corresponding simple element definitions: <xs:element name="lastname" type="xs:string"/> <xs:element name="age" type="xs:integer"/> <xs:element name="dateborn" type="xs:date"/> How to Define a Complex Element Look at this complex XML element, "employee", which contains only other elements: <employee> <firstname>John</firstname> <lastname>Smith</lastname> </employee>
  • 5. We can define a complex element in an XML Schema two different ways: 1. The "employee" element can be declared directly by naming the element, like this: <xs:element name="employee"> <xs:complexType> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <letter> <name>John Smith</name> <orderid>1032</orderid> <shipdate>2001-07-13</shipdate> </letter> The following schema declares the "letter" element: <xs:element name="letter"> <xs:complexType > <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="orderid" type="xs: Integer"/> <xs:element name="shipdate" type="xs:date"/> </xs:sequence> </xs:complexType> </xs:element> Occurrence Indicators Occurrence indicators are used to define how often an element can occur. Note: For all "Order" and "Group" indicators (any, all, choice, sequence, group name, and group reference) the default value for maxOccurs and minOccurs is 1.
  • 6. maxOccurs Indicator The <maxOccurs> indicator specifies the maximum number of times an element can occur: <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="full_name" type="xs:string"/> <xs:element name="child_name" type="xs:string" maxOccurs="10"/> </xs:sequence> </xs:complexType> </xs:element> The example above indicates that the "child_name" element can occur a minimum of one time (the default value for minOccurs is 1) and a maximum of ten times in the "person" element. minOccurs Indicator The <minOccurs> indicator specifies the minimum number of times an element can occur: <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="full_name" type="xs:string"/> <xs:element name="child_name" type="xs:string" maxOccurs="10" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> Complete Example with Indicators An XML Document Let's have a look at this XML document called "Item.xml": XML
  • 7. <item> <title>Empire</title> <note>Special Edition</note> <quantity>1</quantity> <price>10.90</price> </item> <item> XSD <xs:element name="item" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="note" type="xs:string" minOccurs="0"/> <xs:element name="quantity" type="xs:positiveInteger"/> <xs:element name="price" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element>