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

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
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
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
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
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"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
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
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)
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
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
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
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
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

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.