SlideShare una empresa de Scribd logo
1 de 18
Q5M1 - XML Dudy Fathan Ali S.Kom
XML Schema
Q5M1 - XML
Dudy Fathan Ali, S.Kom (DFA)
2015
CEP - CCIT
Fakultas Teknik Universitas Indonesia
Declaring Attributes in a Schema
Q5M1 - XML Dudy Fathan Ali S.Kom
Attributes in an XML schema are declared in the same way as
elements.
Declaring attributes in an XML schema facilitates the assimilation of
information for an XML document.
Attribute declarations can be defined in two ways:
Simple type definitions: Facilitates local validation of the
attribute information.
Global attribute declarations: Enables reuse of attributes.
Attribute
Attribute Element
Q5M1 - XML Dudy Fathan Ali S.Kom
In XSD, an attribute for a user-defined element is declared
using the attribute element.
The syntax for declaring an attribute in XSD is:
<attribute name="attributename"
ref="attributename"
type="datatypename" use="value" value="value">
</attribute>
The attribute element contains attributes that are used to
further qualify and restrict the scope and usage of the user-
defined attribute.
Attribute Element
Q5M1 - XML Dudy Fathan Ali S.Kom
The attribute element consists of the following attributes:
name
ref
type
use
Attribute Element
Q5M1 - XML Dudy Fathan Ali S.Kom
The attribute element consists of the following attributes:
name
ref
type
use
Is used to specify the name of a user-defined attribute.
Must be used when the schema element is the parent
element of the attribute element.
Colon (:) should not be included in the value of the
name attribute.
Attribute Element
Q5M1 - XML Dudy Fathan Ali S.Kom
The attribute element consists of the following attributes:
name
ref
type
use
Is used to refer to a user-defined attribute declared either
in the same or in any other XSD document.
Attribute Element
Q5M1 - XML Dudy Fathan Ali S.Kom
The attribute element consists of the following attributes:
name
ref
type
use
Takes a value that specifies the data type of the user-
defined attribute.
<xsd:attribute name="PRODUCTID"
type="xsd:string">
OR
<xsd:attribute name="PRODID" type="myID">
Attribute Element
Q5M1 - XML Dudy Fathan Ali S.Kom
The attribute element consists of the following attributes:
name
ref
type
use Specifies the way in which an attribute can be used in an
XML document.
Values that can be assigned to the use attribute are
optional, default, required, and fixed.
<xsd:attribute name="baseprice“ type="xsd:integer“ use="optional" />
<xsd:attribute name="baseprice“ type="xsd:integer“ default="25" />
<xsd:attribute name="baseprice“ type="xsd:integer“ use="required" />
<xsd:attribute name="baseprice“ type="xsd:integer" fixed="600“ />
Attribute Element
Q5M1 - XML Dudy Fathan Ali S.Kom
Global Attribute
Q5M1 - XML Dudy Fathan Ali S.Kom
Global attributes are declared outside all element declarations.
Global attributes facilitate attribute reusability.
Global attributes can be associated with simple and complex
data types.
Global attributes have the schema element as the parent
element.
<xsd:schema>
<xsd:attribute name="NAME" type="xsd:string"/>
</xsd:schema>
Global Attribute
Q5M1 - XML Dudy Fathan Ali S.Kom
A global attribute can be reused from anywhere in a schema
<xsd:element name="BOOK" type="BOOKTYPE"/>
<xsd:complexType name="BOOKTYPE">
……..
<xsd:attribute ref="NAME"/>
……..
</xsd:complexType>
<xsd:element name="AUTHOR" type="AUTHORTYPE"/>
<xsd:complexType name="AUTHORTYPE">
……..
<xsd:attribute ref="NAME"/>
……..
</xsd:complexType>
Global Attribute
Q5M1 - XML Dudy Fathan Ali S.Kom
XSD Restrictions
Q5M1 - XML Dudy Fathan Ali S.Kom
In order to restrict values that can be assigned to an attribute
or element:
Declare the attribute or element and associate it with a user-
defined simple data type.
Create a simple data type by using the XSD simpleType
element.
Use the XSD restriction element within the simpleType
element to restrict the values that can be assigned to the
elements or attributes that use the simple data type.
Restricting Values
Q5M1 - XML Dudy Fathan Ali S.Kom
Example Code
Restrictions on Values
Q5M1 - XML Dudy Fathan Ali S.Kom
Consider of this following code, The following example defines an element called "age"
with a restriction. The value of age cannot be lower than 0 or greater than 150:
Restrictions on Values
Q5M1 - XML Dudy Fathan Ali S.Kom
Consider of this following code, The following example defines an element called "gender"
with a restriction. The only acceptable value is Male OR Female:
Restrictions for Datatypes
Q5M1 - XML Dudy Fathan Ali S.Kom
Source : w3schools.com
Q5M1 - XML Dudy Fathan Ali S.Kom
Thank You!
Dudy Fathan Ali S.Kom
dudy.fathan@eng.ui.ac.id

Más contenido relacionado

La actualidad más candente

La actualidad más candente (19)

03 namespace
03 namespace03 namespace
03 namespace
 
Xml basics
Xml basicsXml basics
Xml basics
 
Xml basics for beginning
Xml basics for beginningXml basics for beginning
Xml basics for beginning
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
XML Presentation-2
XML Presentation-2XML Presentation-2
XML Presentation-2
 
Xml Presentation-3
Xml Presentation-3Xml Presentation-3
Xml Presentation-3
 
Xml Presentation-1
Xml Presentation-1Xml Presentation-1
Xml Presentation-1
 
XML
XMLXML
XML
 
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xml
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xmlXml theory 2005_[ngohaianh.info]_1_introduction-to-xml
Xml theory 2005_[ngohaianh.info]_1_introduction-to-xml
 
Xml schema
Xml schemaXml schema
Xml schema
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
XML
XMLXML
XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
Xml schema
Xml schemaXml schema
Xml schema
 
00 introduction
00 introduction00 introduction
00 introduction
 
transforming xml using xsl and xslt
transforming xml using xsl and xslttransforming xml using xsl and xslt
transforming xml using xsl and xslt
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
 

Similar a XML Schema Part 2

Similar a XML Schema Part 2 (20)

XML SCHEMAS
XML SCHEMASXML SCHEMAS
XML SCHEMAS
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
 
Xml part4
Xml part4Xml part4
Xml part4
 
XML Schema
XML SchemaXML Schema
XML Schema
 
XML Schema.pdf
XML Schema.pdfXML Schema.pdf
XML Schema.pdf
 
02 sm3 xml_xp_03
02 sm3 xml_xp_0302 sm3 xml_xp_03
02 sm3 xml_xp_03
 
Xml schema
Xml schemaXml schema
Xml schema
 
Service Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML SchemaService Oriented Architecture-Unit-1-XML Schema
Service Oriented Architecture-Unit-1-XML Schema
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup Language
 
SCDJWS 1. xml schema
SCDJWS 1. xml schemaSCDJWS 1. xml schema
SCDJWS 1. xml schema
 
Tp2
Tp2Tp2
Tp2
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Xml1111
Xml1111Xml1111
Xml1111
 
Web Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdfWeb Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdf
 
Xml session
Xml sessionXml session
Xml session
 
XML's validation - XML Schema
XML's validation - XML SchemaXML's validation - XML Schema
XML's validation - XML Schema
 
distributed system concerned lab sessions
distributed system concerned lab sessionsdistributed system concerned lab sessions
distributed system concerned lab sessions
 
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...
 
XML Schema.pptx
XML Schema.pptxXML Schema.pptx
XML Schema.pptx
 
Xml sasidhar
Xml  sasidharXml  sasidhar
Xml sasidhar
 

Más de Dudy Ali

Understanding COM+
Understanding COM+Understanding COM+
Understanding COM+Dudy Ali
 
Distributed Application Development (Introduction)
Distributed Application Development (Introduction)Distributed Application Development (Introduction)
Distributed Application Development (Introduction)Dudy Ali
 
Java CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseJava CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseDudy Ali
 
Network Socket Programming with JAVA
Network Socket Programming with JAVANetwork Socket Programming with JAVA
Network Socket Programming with JAVADudy Ali
 
Review Materi ASP.NET
Review Materi ASP.NETReview Materi ASP.NET
Review Materi ASP.NETDudy Ali
 
Pengantar XML
Pengantar XMLPengantar XML
Pengantar XMLDudy Ali
 
Pengantar XML DOM
Pengantar XML DOMPengantar XML DOM
Pengantar XML DOMDudy Ali
 
Pengantar ADO.NET
Pengantar ADO.NETPengantar ADO.NET
Pengantar ADO.NETDudy Ali
 
Database Connectivity with JDBC
Database Connectivity with JDBCDatabase Connectivity with JDBC
Database Connectivity with JDBCDudy Ali
 
Algorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma PengurutanAlgorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma PengurutanDudy Ali
 
Algorithm & Data Structure - Pengantar
Algorithm & Data Structure - PengantarAlgorithm & Data Structure - Pengantar
Algorithm & Data Structure - PengantarDudy Ali
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesDudy Ali
 
Object Oriented Programming - Inheritance
Object Oriented Programming - InheritanceObject Oriented Programming - Inheritance
Object Oriented Programming - InheritanceDudy Ali
 
Object Oriented Programming - File Input & Output
Object Oriented Programming - File Input & OutputObject Oriented Programming - File Input & Output
Object Oriented Programming - File Input & OutputDudy Ali
 
Object Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsObject Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsDudy Ali
 
Object Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & EncapsulationObject Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & EncapsulationDudy Ali
 
Web Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman WebWeb Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman WebDudy Ali
 
Web Programming Syaria - PHP
Web Programming Syaria - PHPWeb Programming Syaria - PHP
Web Programming Syaria - PHPDudy Ali
 
Software Project Management - Project Management Knowledge
Software Project Management - Project Management KnowledgeSoftware Project Management - Project Management Knowledge
Software Project Management - Project Management KnowledgeDudy Ali
 
Software Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen ProyekSoftware Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen ProyekDudy Ali
 

Más de Dudy Ali (20)

Understanding COM+
Understanding COM+Understanding COM+
Understanding COM+
 
Distributed Application Development (Introduction)
Distributed Application Development (Introduction)Distributed Application Development (Introduction)
Distributed Application Development (Introduction)
 
Java CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server DatabaseJava CRUD Mechanism with SQL Server Database
Java CRUD Mechanism with SQL Server Database
 
Network Socket Programming with JAVA
Network Socket Programming with JAVANetwork Socket Programming with JAVA
Network Socket Programming with JAVA
 
Review Materi ASP.NET
Review Materi ASP.NETReview Materi ASP.NET
Review Materi ASP.NET
 
Pengantar XML
Pengantar XMLPengantar XML
Pengantar XML
 
Pengantar XML DOM
Pengantar XML DOMPengantar XML DOM
Pengantar XML DOM
 
Pengantar ADO.NET
Pengantar ADO.NETPengantar ADO.NET
Pengantar ADO.NET
 
Database Connectivity with JDBC
Database Connectivity with JDBCDatabase Connectivity with JDBC
Database Connectivity with JDBC
 
Algorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma PengurutanAlgorithm & Data Structure - Algoritma Pengurutan
Algorithm & Data Structure - Algoritma Pengurutan
 
Algorithm & Data Structure - Pengantar
Algorithm & Data Structure - PengantarAlgorithm & Data Structure - Pengantar
Algorithm & Data Structure - Pengantar
 
Object Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference TypesObject Oriented Programming - Value Types & Reference Types
Object Oriented Programming - Value Types & Reference Types
 
Object Oriented Programming - Inheritance
Object Oriented Programming - InheritanceObject Oriented Programming - Inheritance
Object Oriented Programming - Inheritance
 
Object Oriented Programming - File Input & Output
Object Oriented Programming - File Input & OutputObject Oriented Programming - File Input & Output
Object Oriented Programming - File Input & Output
 
Object Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & DestructorsObject Oriented Programming - Constructors & Destructors
Object Oriented Programming - Constructors & Destructors
 
Object Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & EncapsulationObject Oriented Programming - Abstraction & Encapsulation
Object Oriented Programming - Abstraction & Encapsulation
 
Web Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman WebWeb Programming Syaria - Pengenalan Halaman Web
Web Programming Syaria - Pengenalan Halaman Web
 
Web Programming Syaria - PHP
Web Programming Syaria - PHPWeb Programming Syaria - PHP
Web Programming Syaria - PHP
 
Software Project Management - Project Management Knowledge
Software Project Management - Project Management KnowledgeSoftware Project Management - Project Management Knowledge
Software Project Management - Project Management Knowledge
 
Software Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen ProyekSoftware Project Management - Proses Manajemen Proyek
Software Project Management - Proses Manajemen Proyek
 

Último

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

XML Schema Part 2

  • 1. Q5M1 - XML Dudy Fathan Ali S.Kom XML Schema Q5M1 - XML Dudy Fathan Ali, S.Kom (DFA) 2015 CEP - CCIT Fakultas Teknik Universitas Indonesia
  • 2. Declaring Attributes in a Schema Q5M1 - XML Dudy Fathan Ali S.Kom Attributes in an XML schema are declared in the same way as elements. Declaring attributes in an XML schema facilitates the assimilation of information for an XML document. Attribute declarations can be defined in two ways: Simple type definitions: Facilitates local validation of the attribute information. Global attribute declarations: Enables reuse of attributes. Attribute
  • 3. Attribute Element Q5M1 - XML Dudy Fathan Ali S.Kom In XSD, an attribute for a user-defined element is declared using the attribute element. The syntax for declaring an attribute in XSD is: <attribute name="attributename" ref="attributename" type="datatypename" use="value" value="value"> </attribute> The attribute element contains attributes that are used to further qualify and restrict the scope and usage of the user- defined attribute.
  • 4. Attribute Element Q5M1 - XML Dudy Fathan Ali S.Kom The attribute element consists of the following attributes: name ref type use
  • 5. Attribute Element Q5M1 - XML Dudy Fathan Ali S.Kom The attribute element consists of the following attributes: name ref type use Is used to specify the name of a user-defined attribute. Must be used when the schema element is the parent element of the attribute element. Colon (:) should not be included in the value of the name attribute.
  • 6. Attribute Element Q5M1 - XML Dudy Fathan Ali S.Kom The attribute element consists of the following attributes: name ref type use Is used to refer to a user-defined attribute declared either in the same or in any other XSD document.
  • 7. Attribute Element Q5M1 - XML Dudy Fathan Ali S.Kom The attribute element consists of the following attributes: name ref type use Takes a value that specifies the data type of the user- defined attribute. <xsd:attribute name="PRODUCTID" type="xsd:string"> OR <xsd:attribute name="PRODID" type="myID">
  • 8. Attribute Element Q5M1 - XML Dudy Fathan Ali S.Kom The attribute element consists of the following attributes: name ref type use Specifies the way in which an attribute can be used in an XML document. Values that can be assigned to the use attribute are optional, default, required, and fixed. <xsd:attribute name="baseprice“ type="xsd:integer“ use="optional" /> <xsd:attribute name="baseprice“ type="xsd:integer“ default="25" /> <xsd:attribute name="baseprice“ type="xsd:integer“ use="required" /> <xsd:attribute name="baseprice“ type="xsd:integer" fixed="600“ />
  • 9. Attribute Element Q5M1 - XML Dudy Fathan Ali S.Kom
  • 10. Global Attribute Q5M1 - XML Dudy Fathan Ali S.Kom Global attributes are declared outside all element declarations. Global attributes facilitate attribute reusability. Global attributes can be associated with simple and complex data types. Global attributes have the schema element as the parent element. <xsd:schema> <xsd:attribute name="NAME" type="xsd:string"/> </xsd:schema>
  • 11. Global Attribute Q5M1 - XML Dudy Fathan Ali S.Kom A global attribute can be reused from anywhere in a schema <xsd:element name="BOOK" type="BOOKTYPE"/> <xsd:complexType name="BOOKTYPE"> …….. <xsd:attribute ref="NAME"/> …….. </xsd:complexType> <xsd:element name="AUTHOR" type="AUTHORTYPE"/> <xsd:complexType name="AUTHORTYPE"> …….. <xsd:attribute ref="NAME"/> …….. </xsd:complexType>
  • 12. Global Attribute Q5M1 - XML Dudy Fathan Ali S.Kom
  • 13. XSD Restrictions Q5M1 - XML Dudy Fathan Ali S.Kom In order to restrict values that can be assigned to an attribute or element: Declare the attribute or element and associate it with a user- defined simple data type. Create a simple data type by using the XSD simpleType element. Use the XSD restriction element within the simpleType element to restrict the values that can be assigned to the elements or attributes that use the simple data type.
  • 14. Restricting Values Q5M1 - XML Dudy Fathan Ali S.Kom Example Code
  • 15. Restrictions on Values Q5M1 - XML Dudy Fathan Ali S.Kom Consider of this following code, The following example defines an element called "age" with a restriction. The value of age cannot be lower than 0 or greater than 150:
  • 16. Restrictions on Values Q5M1 - XML Dudy Fathan Ali S.Kom Consider of this following code, The following example defines an element called "gender" with a restriction. The only acceptable value is Male OR Female:
  • 17. Restrictions for Datatypes Q5M1 - XML Dudy Fathan Ali S.Kom Source : w3schools.com
  • 18. Q5M1 - XML Dudy Fathan Ali S.Kom Thank You! Dudy Fathan Ali S.Kom dudy.fathan@eng.ui.ac.id