SlideShare a Scribd company logo
1 of 16
SCHEMA OVERVIEW e-logistics 2009 Eduard Rodés Gubern Port de Barcelona
Purpose of XML Schemas  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A First Look ,[object Object]
what each element contains ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Schema – friend.xsd ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ATTLIST ELEMENT ID #PCDATA NMTOKEN ENTITY CDATA friend name zip address country city street This is the vocabulary that  DTDs provide to define your new vocabulary (Source:Roger L. Costello)
element complexType schema sequence http://www.w3.org/2001/XMLSchema string integer boolean This is the vocabulary that  XML Schemas provide to define your new vocabulary 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) [because DTDs pre-dated namespaces]. friend name zip address country city street http://www.galactinav.com ( targetNamespace ) (Source:Roger L. Costello)
XML instance document ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],If you want to validate the files http://tools.decisionsoft.com/schemaValidate / Or download xmlspy www.altova.com
Referencing a schema in an XML instance document BookStore.xml BookStore.xsd targetNamespace="http://www.books.org" schemaLocation="http://www.books.org BookStore.xsd" -  defines  elements in namespace http://www.books.org -  uses  elements from namespace http://www.books.org A schema  defines  a new vocabulary.  Instance documents  use  that new vocabulary. (Source:Roger L. Costello)
Note multiple levels of checking BookStore.xml BookStore.xsd XMLSchema.xsd (schema-for-schemas) Validate that the xml document conforms to the rules described in BookStore.xsd Validate that  BookStore.xsd is a valid schema document, i.e., it conforms to the rules described in the schema-for-schemas (Source:Roger L. Costello)
Default Value for minOccurs and maxOccurs ,[object Object],[object Object],<xsd:element ref=&quot;Title&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/> <xsd:element ref=&quot;Title&quot;/> Equivalent! (Source:Roger L. Costello)
Named Types <?xml version=&quot;1.0&quot;?> <xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; targetNamespace=&quot;http://www.galactinav.com&quot; xmlns=&quot;http://www.galactinav.org&quot; elementFormDefault=&quot;qualified&quot;> <xsd:element name=“addressbook&quot;> <xsd:complexType> <xsd:sequence> <xsd:element name=“ friend &quot; maxOccurs=&quot;unbounded&quot;/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name=&quot;friend“> <xsd:complexType> <xsd:sequence> <xsd:element name=“name”/> <xsd:element name=“address&quot;  type=“addressdata”  maxOccurs=&quot;unbounded&quot;/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType  name=“addressdata” > <xsd:sequence> <xsd:element name=&quot;street&quot; type=“string”/> <xsd:element name=&quot;city&quot; type=“string”/> <xsd:element name=&quot;country&quot; type=“string”/> <xsd:element name=&quot;zip&quot; type=“string”/> </xsd:sequence> </xsd:complexType> </xsd:schema> The advantage of splitting out friend's element declarations and wrapping them in a named type is that now this type can be  reused  by other elements. Named type
Built-in datatypes (Source:W3C Recomendation)
Built-in datatypes Primitive Note: 'T' is the date/time separator INF = infinity NAN = not-a-number a NOTATION from the XML spec NOTATION a namespace qualified name QName http://www.xfront.com anyURI a base64 string base64Binary a hex string hexBinary  format: --MM-- gMonth format: ---DD (note the 3 dashes) gDay format: --MM-DD gMonthDay format: CCYY gYear format: CCYY-MM gYearMonth format: CCYY-MM-DD date format: hh:mm:ss.sss time format: CCYY-MM-DDThh-mm-ss dateTime P1Y2M3DT10H30M12.3S duration 12.56E3, 12, 12560, 0, -0, INF, -INF, NAN  double 12.56E3, 12, 12560, 0, -0, INF, -INF, NAN  float 7.08 decimal {true, false} boolean &quot;Hello World&quot; string
Built-in datatypes Derived 1  to infinity positiveInteger 0 to 255 unsignedByte 0 to 65535 unsignedShort 0 to 4294967295 unsignedInt 0 to 18446744073709551615 unsignedLong 0 to infinity nonNegativeInteger -127 to 128 byte -32768 to 32767 short -2147483648 to 2147483647 int  -9223372036854775808 to 9223372036854775808  long negative infinity to -1 negativeInteger negative infinity to 0 nonPositiveInteger 456 integer must be used only with attributes ENTITY must be used only with attributes IDREF must be used only with attributes ID part (no namespace qualifier) NCName   Name must be used only with attributes NMTOKENS must be used only with attributes NMTOKEN must be used only with attributes ENTITIES must be used only with attributes IDREFS any valid xml:lang value, e.g., EN, FR, ...  language String w/o tabs, l/f, leading/trailing spaces, consecutive spaces token A string without tabs, line feeds, or carriage returns normalizedString
Attributes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<xs:element name=&quot;img&quot;> <xs:complexType> <xs:attributeGroup ref=&quot;attrs&quot;/> <xs:attribute name=&quot;src&quot; use=&quot;required&quot; type=&quot;URI&quot;/> <xs:attribute name=&quot;alt&quot; use=&quot;required&quot; type=&quot;Text&quot;/>   <xs:attribute name=&quot;height&quot; type=&quot;Length&quot;/> <xs:attribute name=&quot;width&quot; type=&quot;Length&quot;/> </xs:complexType> </xs:element>

More Related Content

What's hot (20)

Introduction to xml schema
Introduction to xml schemaIntroduction to xml schema
Introduction to xml schema
 
Xml schema
Xml schemaXml schema
Xml schema
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
4 xml namespaces and xml schema
4   xml namespaces and xml schema4   xml namespaces and xml schema
4 xml namespaces and xml schema
 
XML Schema
XML SchemaXML Schema
XML Schema
 
XML's validation - XML Schema
XML's validation - XML SchemaXML's validation - XML Schema
XML's validation - XML Schema
 
Xml and Co.
Xml and Co.Xml and Co.
Xml and Co.
 
Xml by Luqman
Xml by LuqmanXml by Luqman
Xml by Luqman
 
Xsd
XsdXsd
Xsd
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
Dtd
DtdDtd
Dtd
 
DTD
DTDDTD
DTD
 
JSON and MongoDB in R
JSON and MongoDB in RJSON and MongoDB in R
JSON and MongoDB in R
 
3 xml namespaces and xml schema
3   xml namespaces and xml schema3   xml namespaces and xml schema
3 xml namespaces and xml schema
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
 
Xml schema
Xml schemaXml schema
Xml schema
 
Tp2
Tp2Tp2
Tp2
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
Document Type Definitions
Document Type DefinitionsDocument Type Definitions
Document Type Definitions
 
DTD
DTDDTD
DTD
 

Similar to Schema

Similar to Schema (20)

Xml
XmlXml
Xml
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond
 
Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
5 xsl (formatting xml documents)
5   xsl (formatting xml documents)5   xsl (formatting xml documents)
5 xsl (formatting xml documents)
 
XML Presentation-2
XML Presentation-2XML Presentation-2
XML Presentation-2
 
Javascript2839
Javascript2839Javascript2839
Javascript2839
 
Json
JsonJson
Json
 
35 schemas
35 schemas35 schemas
35 schemas
 
Displaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSLDisplaying XML Documents Using CSS and XSL
Displaying XML Documents Using CSS and XSL
 
XML Schema.pptx
XML Schema.pptxXML Schema.pptx
XML Schema.pptx
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Xml session
Xml sessionXml session
Xml session
 
Xml
XmlXml
Xml
 
Xml For Dummies Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
Xml For Dummies   Chapter 10 Building A Custom Xml Schema it-slideshares.blog...Xml For Dummies   Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
Xml For Dummies Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
 
Xsd
XsdXsd
Xsd
 
2310 b 12
2310 b 122310 b 12
2310 b 12
 
Xml
XmlXml
Xml
 
What is xml
What is xmlWhat is xml
What is xml
 

More from Ergoclicks

7 Intercambio Documental
7 Intercambio Documental7 Intercambio Documental
7 Intercambio DocumentalErgoclicks
 
4 Guia Xhtm Lv2.1
4   Guia Xhtm Lv2.14   Guia Xhtm Lv2.1
4 Guia Xhtm Lv2.1Ergoclicks
 
O9standarddefinitions
O9standarddefinitionsO9standarddefinitions
O9standarddefinitionsErgoclicks
 
Tbg309092 Cargo Xml Task Force Draft To R V0.7 (Clean)
Tbg309092 Cargo Xml Task Force   Draft To R V0.7 (Clean)Tbg309092 Cargo Xml Task Force   Draft To R V0.7 (Clean)
Tbg309092 Cargo Xml Task Force Draft To R V0.7 (Clean)Ergoclicks
 
Tbg306063 Tbg3 Terms Of Reference Sept 2006 V3
Tbg306063  Tbg3 Terms Of Reference Sept 2006 V3Tbg306063  Tbg3 Terms Of Reference Sept 2006 V3
Tbg306063 Tbg3 Terms Of Reference Sept 2006 V3Ergoclicks
 
Dossier Short Sea Shipping
Dossier Short Sea ShippingDossier Short Sea Shipping
Dossier Short Sea ShippingErgoclicks
 
Tbg309093 Cargo Xml Electronic Messages Approach V0.4
Tbg309093 Cargo Xml Electronic Messages     Approach V0.4Tbg309093 Cargo Xml Electronic Messages     Approach V0.4
Tbg309093 Cargo Xml Electronic Messages Approach V0.4Ergoclicks
 
Iata Cargo Xml Electronic Messages Approach V0.4
Iata Cargo Xml Electronic Messages     Approach V0.4Iata Cargo Xml Electronic Messages     Approach V0.4
Iata Cargo Xml Electronic Messages Approach V0.4Ergoclicks
 

More from Ergoclicks (17)

7 Intercambio Documental
7 Intercambio Documental7 Intercambio Documental
7 Intercambio Documental
 
8 Xml
8 Xml8 Xml
8 Xml
 
4 Guia Xhtm Lv2.1
4   Guia Xhtm Lv2.14   Guia Xhtm Lv2.1
4 Guia Xhtm Lv2.1
 
4 Html
4 Html4 Html
4 Html
 
galactinav
galactinavgalactinav
galactinav
 
O9standarddefinitions
O9standarddefinitionsO9standarddefinitions
O9standarddefinitions
 
O9edifact
O9edifactO9edifact
O9edifact
 
O9schema
O9schemaO9schema
O9schema
 
O9ebxml
O9ebxmlO9ebxml
O9ebxml
 
O9xml
O9xmlO9xml
O9xml
 
Tbg309092 Cargo Xml Task Force Draft To R V0.7 (Clean)
Tbg309092 Cargo Xml Task Force   Draft To R V0.7 (Clean)Tbg309092 Cargo Xml Task Force   Draft To R V0.7 (Clean)
Tbg309092 Cargo Xml Task Force Draft To R V0.7 (Clean)
 
Tbg306063 Tbg3 Terms Of Reference Sept 2006 V3
Tbg306063  Tbg3 Terms Of Reference Sept 2006 V3Tbg306063  Tbg3 Terms Of Reference Sept 2006 V3
Tbg306063 Tbg3 Terms Of Reference Sept 2006 V3
 
Dossier Short Sea Shipping
Dossier Short Sea ShippingDossier Short Sea Shipping
Dossier Short Sea Shipping
 
Cluetrain
CluetrainCluetrain
Cluetrain
 
Tbg309093 Cargo Xml Electronic Messages Approach V0.4
Tbg309093 Cargo Xml Electronic Messages     Approach V0.4Tbg309093 Cargo Xml Electronic Messages     Approach V0.4
Tbg309093 Cargo Xml Electronic Messages Approach V0.4
 
Iata Cargo Xml Electronic Messages Approach V0.4
Iata Cargo Xml Electronic Messages     Approach V0.4Iata Cargo Xml Electronic Messages     Approach V0.4
Iata Cargo Xml Electronic Messages Approach V0.4
 
Edifact
EdifactEdifact
Edifact
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

Schema

  • 1. SCHEMA OVERVIEW e-logistics 2009 Eduard Rodés Gubern Port de Barcelona
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. ATTLIST ELEMENT ID #PCDATA NMTOKEN ENTITY CDATA friend name zip address country city street This is the vocabulary that DTDs provide to define your new vocabulary (Source:Roger L. Costello)
  • 7. element complexType schema sequence http://www.w3.org/2001/XMLSchema string integer boolean This is the vocabulary that XML Schemas provide to define your new vocabulary 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) [because DTDs pre-dated namespaces]. friend name zip address country city street http://www.galactinav.com ( targetNamespace ) (Source:Roger L. Costello)
  • 8.
  • 9. Referencing a schema in an XML instance document BookStore.xml BookStore.xsd targetNamespace=&quot;http://www.books.org&quot; schemaLocation=&quot;http://www.books.org BookStore.xsd&quot; - defines elements in namespace http://www.books.org - uses elements from namespace http://www.books.org A schema defines a new vocabulary. Instance documents use that new vocabulary. (Source:Roger L. Costello)
  • 10. Note multiple levels of checking BookStore.xml BookStore.xsd XMLSchema.xsd (schema-for-schemas) Validate that the xml document conforms to the rules described in BookStore.xsd Validate that BookStore.xsd is a valid schema document, i.e., it conforms to the rules described in the schema-for-schemas (Source:Roger L. Costello)
  • 11.
  • 12. Named Types <?xml version=&quot;1.0&quot;?> <xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; targetNamespace=&quot;http://www.galactinav.com&quot; xmlns=&quot;http://www.galactinav.org&quot; elementFormDefault=&quot;qualified&quot;> <xsd:element name=“addressbook&quot;> <xsd:complexType> <xsd:sequence> <xsd:element name=“ friend &quot; maxOccurs=&quot;unbounded&quot;/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name=&quot;friend“> <xsd:complexType> <xsd:sequence> <xsd:element name=“name”/> <xsd:element name=“address&quot; type=“addressdata” maxOccurs=&quot;unbounded&quot;/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name=“addressdata” > <xsd:sequence> <xsd:element name=&quot;street&quot; type=“string”/> <xsd:element name=&quot;city&quot; type=“string”/> <xsd:element name=&quot;country&quot; type=“string”/> <xsd:element name=&quot;zip&quot; type=“string”/> </xsd:sequence> </xsd:complexType> </xsd:schema> The advantage of splitting out friend's element declarations and wrapping them in a named type is that now this type can be reused by other elements. Named type
  • 14. Built-in datatypes Primitive Note: 'T' is the date/time separator INF = infinity NAN = not-a-number a NOTATION from the XML spec NOTATION a namespace qualified name QName http://www.xfront.com anyURI a base64 string base64Binary a hex string hexBinary format: --MM-- gMonth format: ---DD (note the 3 dashes) gDay format: --MM-DD gMonthDay format: CCYY gYear format: CCYY-MM gYearMonth format: CCYY-MM-DD date format: hh:mm:ss.sss time format: CCYY-MM-DDThh-mm-ss dateTime P1Y2M3DT10H30M12.3S duration 12.56E3, 12, 12560, 0, -0, INF, -INF, NAN double 12.56E3, 12, 12560, 0, -0, INF, -INF, NAN float 7.08 decimal {true, false} boolean &quot;Hello World&quot; string
  • 15. Built-in datatypes Derived 1 to infinity positiveInteger 0 to 255 unsignedByte 0 to 65535 unsignedShort 0 to 4294967295 unsignedInt 0 to 18446744073709551615 unsignedLong 0 to infinity nonNegativeInteger -127 to 128 byte -32768 to 32767 short -2147483648 to 2147483647 int -9223372036854775808 to 9223372036854775808 long negative infinity to -1 negativeInteger negative infinity to 0 nonPositiveInteger 456 integer must be used only with attributes ENTITY must be used only with attributes IDREF must be used only with attributes ID part (no namespace qualifier) NCName   Name must be used only with attributes NMTOKENS must be used only with attributes NMTOKEN must be used only with attributes ENTITIES must be used only with attributes IDREFS any valid xml:lang value, e.g., EN, FR, ... language String w/o tabs, l/f, leading/trailing spaces, consecutive spaces token A string without tabs, line feeds, or carriage returns normalizedString
  • 16.