SlideShare a Scribd company logo
1 of 42
Download to read offline
IT6801
SERVICE ORIENTED
ARCHITECTURE
-
UNIT I INTRODUCTION TO XML
XML document structure – Well formed and valid
documents – Namespaces – DTD – XML Schema
– X-Files.
XML Schema
Referred as XML Schema Definition (XSD)
An XML Schema describes the structure of an XML
document.
DTD VS XSD
• In short, DTD provides less control on XML structure whereas XSD (XML
schema) provides more control
No. DTD XSD
1 DTD stands for Document Type Definition. XSD stands for XML Schema Definition.
2 DTDs are derived from SGMLsyntax. XSDs are written in XML.
3 DTD doesn't support datatypes.
XSD supports datatypes for elements and
attributes.
4 DTD doesn't support namespace. XSD supports namespace.
5 DTD doesn't define order for child
elements.
XSD defines order for child elements.
6 DTD is not extensible. XSD is extensible.
7 DTD is not simple to learn.
XSD is simple to learn because you don't
need to learn new language..
8 DTD provides less control on XML
structure.
XSD provides more control on XML
structure.
What You Should Already Know
• Before you continue, have a basic understanding of the
following:
– HTML
– XML
– A basic understanding of DTD
What is an XML Schema?
• An XML Schema
– Describes the structure of an XML document, just like a DTD.
• An XML document with correct syntax is called "Well Formed".
• An XML document validated against an XML Schema is both
"Well Formed" and "Valid".
What XML Schema Defines?
• 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
Why Use XML Schemas?
• XML Schemas Support Data Types
• XML Schemas use XML Syntax
• XML Schemas Secure Data Communication
• XML Schemas are Extensible
Why Use XML Schemas?
• Well-Formed XML document is not Enough
– Even if documents are well-formed they can still contain errors, and
those errors can have serious consequences.
• Think of the following situation:
– You order 5 dozens of laser printers, instead of 5 laser printers.
– With XML Schemas,
• Most of these errors can be caught by your validating software.
XSD - The <schema> Element
General Form :
<?xml version="1.0"?>
<xs:schema>
...
...
</xs:schema>
The <schema> element may contain some attributes.
Example
A 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>
DTD file called "note.dtd"
That defines the elements of the above XML document
<!ELEMENT note (to, from, heading, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
An XML Schema
• An XML Schema file "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>
Other elements (to, from, heading, body)
are simple types because they do not contain
other elements.
Note element is a complex
type because it contains other
elements.
Description of XML Schema
• <xs:element name="note">
– Defines the element name employee
• <xs:complexType>
– Defines that the element ‘note' is complex type
• <xs:sequence>
– Defines that the complex type is a sequence of elements
• <xs:element name="to" type="xs:string"/>
– Defines that the element ‘to' is of type string (text)
     
Description of XML Schema
• xmlns:xs = http://www.w3.org/2001/XMLSchema
– Indicates that the elements and data types used in the schema
come from the "http://www.w3.org/2001/XMLSchema" namespace.
– And specifies, that namespace should be prefixed with xs:
• targetNamespace = http://www.w3schools.com
– Indicates that the location of namespace.
Description of XML Schema
• xmlns=http://www.w3schools.com
– Indicates that the default namespace is "http://www.w3schools.com".
• elementFormDefault="qualified“
– indicates that any elements used by XML instance document which
were declared in this schema must be namespace qualified.
What is a Simple Element?
• A simple element is an XML element that can contain only text
– It cannot contain any other elements or attributes.
• Text can be of many different types.
– It can be one of the types included in XML Schema definition
(boolean, string, date, etc.), or
– It can be a custom type that you can define yourself.
• Syntax for defining a simple element is:
<xs:element name="xxx" type="yyy"/>
Most Common Types
• XML Schema has a lot of built-in data types.
• Most common types are:
 xs:string
 xs:decimal
 xs:integer
 xs:boolean
 xs:date (YYYY-MM-DD)
 xs:time (HH:MM:SS)
Fixed Values for Simple Elements
• A fixed value is automatically assigned to the element,
– You cannot specify another value.
• In the following example the fixed value is "red":
<xs:element name="color" 
    type="xs:string" fixed="red"/>
Default Values for Simple Elements
• A default value is automatically assigned to the element
– When no other value is specified.
• In the following example the default value is "red":
<xs:element name="color" 
    type="xs:string" default="red"/>
XSD Attributes
• Simple elements cannot have attributes.
• If an element has attributes,
– It is considered to be of a complex type.
• But the attribute itself is always declared as a simple type.
<xs:attribute name="xxx" type="yyy"/>
xxx is the name of the attribute
yyy specifies the data type of the attribute.
Example of XSD Attributes
• Here is an XML element with an attribute:
       <lastname lang="EN">Smith</lastname>
• And here is the corresponding attribute definition:
    
<xs:attribute name="lang" type="xs:string"/>
Optional and Required Attributes
• Attributes are optional by default.
• To specify that the attribute is required, use the "use" attribute:
<xs:attribute name="lang" 
     type="xs:string" 
               use="required"/>
Restrictions on Values
• Example : Define an element called "age" with a restriction.
– The value of age cannot be lower than 0 or greater than 120:
<xs:element name="age">
  <xs:simpleType>
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="120"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>
Restrictions on a Set of Values
• Limit the content of XML element to a set of acceptable values
– Use the enumeration constraint.
• Ex : Define an element called "car" with a restriction.
– The only acceptable values are: Audi, Golf, BMW:
<xs:element name="age">
  <xs:simpleType>
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="120"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>
Restrictions on a Series of Values
• Ex : Defines an element called “letter" with a restriction.
– Acceptable value is one of the LOWERCASE letters from a to z:
<xs:restriction base="xs:string">
      <xs:pattern value="[a-z]"/>
Value must be min. 5 characters and max. 8 characters:
Restrictions on Length
Value must be exactly 8 characters:
<xs:element name="password">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:length value="8"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>
<xs:element name="password">
  <xs:simpleType>
    <xs:restriction base="xs:string">
      <xs:minLength value="5"/>
      <xs:maxLength value="8"/>
    </xs:restriction>
  </xs:simpleType>
</xs:element>
XML Document Structure
-
XML Document Structure
• An XML document consists of a number of discrete components
• Not all the sections of an XML document may be necessary,
– But their inclusion helps to make for a well-structured XML document
• A well-structured XML document can
– Easily be transported between systems and devices
Major portions of an XML document
• The major portions of an XML document include the following:
– The XML declaration
– The Document Type Declaration (DTD)
– The element data
– The attribute data
– The character data or XML content
XML Declaration
• XML Declaration is a definite way of stating exactly
– What the document contains.
• XML document can optionally have an XML declaration
– It must be the first statement of the XML document
• XML declaration is a processing instruction of the form
<?xml ...?>
Components of XML Declaration
Component Meaning
<?xml Starts the beginning of the processing instruction
Version= “xxx” Describes the specific version of XML being used
standalone= “xxx” Defines whether documents are allowed to contain
external markup declarations
encoding= “xxx” Indicates the character encoding that the document uses.
The default is “US-ASCII” but can be set to any value
Example :
Document Type Declaration (DTD)
• A DTD defines the structure and the legal elements and
attributes of an XML document.
• An application can use a DTD to verify that XML data is valid.
• If the DTD is declared inside the XML file, it must be wrapped
inside the <!DOCTYPE> definition:
• Document Type Declaration (DOCTYPE) gives a name to the
XML content
• A Document Type Declaration (DOCTYPE)
– Names the document type and
– Identifies the internal content
OOA
• OOA emphasis on
– Finding and describing the objects (or concepts in the problem
domain)
• OOD emphasis on
– Defining software What the system does (its static structure and
behavior),
• OOD focuses on
– How the system does it (it’s run-time implementation).
OOA
• During OOA, the most important purpose is
– To identify objects and describing them in a proper way.
• Objects should be identified with responsibilities.
• Responsibilities are the functions performed by the object.
– Each and every object has some type of responsibilities to be performed.
• When these responsibilities are collaborated the purpose of the system is
fulfilled.
OOD
• Second phase is OOD. During this phase
– Emphasis is given upon the requirements and their fulfillment.
• In this stage,
– The objects are collaborated according to their intended association.
• After the association is complete the design is also complete.
• Third phase is object oriented implementation.
– In this phase the design is implemented using object oriented languages like
Java, C++ etc.
UML
• OO design is transformed into UML diagrams according to the
requirement.
• Input from the OO analysis and design is the input to the UML diagrams.
• UML is a modeling language used to model s/w and non s/w systems.
• Although UML is used for non software systems
– Emphasis is on modeling object oriented software applications.
Conceptual model of UML
• A conceptual model can be defined as
– A model which is made of concepts and their relationships
• A conceptual model is the first step before drawing a UML diagram.
• It helps to
– Understand the entities in the real world and how they interact with each other.
• Conceptual model of UML can be mastered by learning the 3 major
elements:
1. UML building blocks
2. Rules to connect the building blocks
3. Common mechanisms of UML
UML building blocks
• Three building blocks of UML are:
– Things
– Relationships
– Diagrams
Object
• Object is a term used to represent a real world entity within
the system being modeled
• Objects has its own attributes and operations (methods).
– Consider the real world object “Car”
make = ford
model = escape
year = 2002
color = green
maximum speed = 130 mph
current speed = 50 mph
accelerate ()
decelerate ()
refuel ()
Network
• During the OOA phase object-modeling techniques are used
• To reflect the structure and behaviour of the system
– A range of models can be created using such objects

More Related Content

What's hot (20)

Bootstrap PPT Part - 2
Bootstrap PPT Part - 2Bootstrap PPT Part - 2
Bootstrap PPT Part - 2
 
XML Databases
XML DatabasesXML Databases
XML Databases
 
XML
XMLXML
XML
 
Client side scripting and server side scripting
Client side scripting and server side scriptingClient side scripting and server side scripting
Client side scripting and server side scripting
 
10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMS
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Android application structure
Android application structureAndroid application structure
Android application structure
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Xml
XmlXml
Xml
 
Extensible Markup Language (XML)
Extensible Markup Language (XML)Extensible Markup Language (XML)
Extensible Markup Language (XML)
 
Html frames
Html framesHtml frames
Html frames
 
XSLT
XSLTXSLT
XSLT
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLT
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
XSD
XSDXSD
XSD
 
Xml parsing
Xml parsingXml parsing
Xml parsing
 
jstl ( jsp standard tag library )
jstl ( jsp standard tag library )jstl ( jsp standard tag library )
jstl ( jsp standard tag library )
 

Similar to 02 xml schema (20)

XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
Web Service Workshop - 3 days
Web Service Workshop - 3 daysWeb Service Workshop - 3 days
Web Service Workshop - 3 days
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Xsd
XsdXsd
Xsd
 
Xsd
XsdXsd
Xsd
 
Xml part4
Xml part4Xml part4
Xml part4
 
Xml schema
Xml schemaXml schema
Xml schema
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 
XML SCHEMAS
XML SCHEMASXML SCHEMAS
XML SCHEMAS
 
XML Fundamentals
XML FundamentalsXML Fundamentals
XML Fundamentals
 
Xml 2
Xml  2 Xml  2
Xml 2
 
Introduction to xml schema
Introduction to xml schemaIntroduction to xml schema
Introduction to xml schema
 
XML
XMLXML
XML
 
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
 
XML's validation - XML Schema
XML's validation - XML SchemaXML's validation - XML Schema
XML's validation - XML Schema
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Xml andweb services
Xml andweb services Xml andweb services
Xml andweb services
 

More from Baskarkncet

02 well formed and valid documents
02 well formed and valid documents02 well formed and valid documents
02 well formed and valid documentsBaskarkncet
 
11 deployment diagrams
11 deployment diagrams11 deployment diagrams
11 deployment diagramsBaskarkncet
 
10 component diagram
10 component diagram10 component diagram
10 component diagramBaskarkncet
 
09 package diagram
09 package diagram09 package diagram
09 package diagramBaskarkncet
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagramBaskarkncet
 
07 interaction diagrams
07 interaction diagrams07 interaction diagrams
07 interaction diagramsBaskarkncet
 
06 class diagrams
06 class diagrams06 class diagrams
06 class diagramsBaskarkncet
 
03 unified process
03 unified process03 unified process
03 unified processBaskarkncet
 

More from Baskarkncet (19)

Unit_I.pptx
Unit_I.pptxUnit_I.pptx
Unit_I.pptx
 
Cocomo model
Cocomo modelCocomo model
Cocomo model
 
Unit 1
Unit 1Unit 1
Unit 1
 
HCI
HCIHCI
HCI
 
03 x files
03 x files03 x files
03 x files
 
03 namespace
03 namespace03 namespace
03 namespace
 
02 well formed and valid documents
02 well formed and valid documents02 well formed and valid documents
02 well formed and valid documents
 
00 introduction
00 introduction00 introduction
00 introduction
 
11 deployment diagrams
11 deployment diagrams11 deployment diagrams
11 deployment diagrams
 
10 component diagram
10 component diagram10 component diagram
10 component diagram
 
09 package diagram
09 package diagram09 package diagram
09 package diagram
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagram
 
07 interaction diagrams
07 interaction diagrams07 interaction diagrams
07 interaction diagrams
 
06 class diagrams
06 class diagrams06 class diagrams
06 class diagrams
 
05 use case
05 use case05 use case
05 use case
 
03 unified process
03 unified process03 unified process
03 unified process
 
02 uml
02 uml02 uml
02 uml
 
04 uml diagrams
04 uml diagrams04 uml diagrams
04 uml diagrams
 
01 introduction
01 introduction01 introduction
01 introduction
 

Recently uploaded

FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxRomil Mishra
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...shreenathji26
 
The Satellite applications in telecommunication
The Satellite applications in telecommunicationThe Satellite applications in telecommunication
The Satellite applications in telecommunicationnovrain7111
 
ADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain studyADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain studydhruvamdhruvil123
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
tourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdftourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdfchess188chess188
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...
Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...
Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...Amil baba
 
Javier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptxJavier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptxJavier Fernández Muñoz
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labsamber724300
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProRay Yuan Liu
 
Module-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdfModule-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdfManish Kumar
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Structural Integrity Assessment Standards in Nigeria by Engr Nimot Muili
Structural Integrity Assessment Standards in Nigeria by Engr Nimot MuiliStructural Integrity Assessment Standards in Nigeria by Engr Nimot Muili
Structural Integrity Assessment Standards in Nigeria by Engr Nimot MuiliNimot Muili
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
Indian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdfIndian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdfalokitpathak01
 

Recently uploaded (20)

Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
Introduction to Artificial Intelligence: Intelligent Agents, State Space Sear...
 
The Satellite applications in telecommunication
The Satellite applications in telecommunicationThe Satellite applications in telecommunication
The Satellite applications in telecommunication
 
ADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain studyADM100 Running Book for sap basis domain study
ADM100 Running Book for sap basis domain study
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
tourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdftourism-management-srs_compress-software-engineering.pdf
tourism-management-srs_compress-software-engineering.pdf
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...
Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...
Uk-NO1 Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Exp...
 
Javier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptxJavier_Fernandez_CARS_workshop_presentation.pptx
Javier_Fernandez_CARS_workshop_presentation.pptx
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labs
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision Pro
 
Module-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdfModule-1-Building Acoustics(Introduction)(Unit-1).pdf
Module-1-Building Acoustics(Introduction)(Unit-1).pdf
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Structural Integrity Assessment Standards in Nigeria by Engr Nimot Muili
Structural Integrity Assessment Standards in Nigeria by Engr Nimot MuiliStructural Integrity Assessment Standards in Nigeria by Engr Nimot Muili
Structural Integrity Assessment Standards in Nigeria by Engr Nimot Muili
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
Indian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdfIndian Tradition, Culture & Societies.pdf
Indian Tradition, Culture & Societies.pdf
 

02 xml schema

  • 2. UNIT I INTRODUCTION TO XML XML document structure – Well formed and valid documents – Namespaces – DTD – XML Schema – X-Files.
  • 3. XML Schema Referred as XML Schema Definition (XSD) An XML Schema describes the structure of an XML document.
  • 4. DTD VS XSD • In short, DTD provides less control on XML structure whereas XSD (XML schema) provides more control No. DTD XSD 1 DTD stands for Document Type Definition. XSD stands for XML Schema Definition. 2 DTDs are derived from SGMLsyntax. XSDs are written in XML. 3 DTD doesn't support datatypes. XSD supports datatypes for elements and attributes. 4 DTD doesn't support namespace. XSD supports namespace. 5 DTD doesn't define order for child elements. XSD defines order for child elements. 6 DTD is not extensible. XSD is extensible. 7 DTD is not simple to learn. XSD is simple to learn because you don't need to learn new language.. 8 DTD provides less control on XML structure. XSD provides more control on XML structure.
  • 5. What You Should Already Know • Before you continue, have a basic understanding of the following: – HTML – XML – A basic understanding of DTD
  • 6. What is an XML Schema? • An XML Schema – Describes the structure of an XML document, just like a DTD. • An XML document with correct syntax is called "Well Formed". • An XML document validated against an XML Schema is both "Well Formed" and "Valid".
  • 7. What XML Schema Defines? • An XML Schema: – Defines elements that can appear in a document – Defines attributes that can appear in a document – Defines which elements are child elements – Defines the order of child elements – Defines the number of child elements – Defines whether an element is empty or can include text – Defines data types for elements and attributes – Defines default and fixed values for elements and attributes
  • 8. Why Use XML Schemas? • XML Schemas Support Data Types • XML Schemas use XML Syntax • XML Schemas Secure Data Communication • XML Schemas are Extensible
  • 9. Why Use XML Schemas? • Well-Formed XML document is not Enough – Even if documents are well-formed they can still contain errors, and those errors can have serious consequences. • Think of the following situation: – You order 5 dozens of laser printers, instead of 5 laser printers. – With XML Schemas, • Most of these errors can be caught by your validating software.
  • 10. XSD - The <schema> Element General Form : <?xml version="1.0"?> <xs:schema> ... ... </xs:schema> The <schema> element may contain some attributes.
  • 11. Example A 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> DTD file called "note.dtd" That defines the elements of the above XML document <!ELEMENT note (to, from, heading, body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)>
  • 12. An XML Schema • An XML Schema file "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> Other elements (to, from, heading, body) are simple types because they do not contain other elements. Note element is a complex type because it contains other elements.
  • 13. Description of XML Schema • <xs:element name="note"> – Defines the element name employee • <xs:complexType> – Defines that the element ‘note' is complex type • <xs:sequence> – Defines that the complex type is a sequence of elements • <xs:element name="to" type="xs:string"/> – Defines that the element ‘to' is of type string (text)      
  • 14. Description of XML Schema • xmlns:xs = http://www.w3.org/2001/XMLSchema – Indicates that the elements and data types used in the schema come from the "http://www.w3.org/2001/XMLSchema" namespace. – And specifies, that namespace should be prefixed with xs: • targetNamespace = http://www.w3schools.com – Indicates that the location of namespace.
  • 15. Description of XML Schema • xmlns=http://www.w3schools.com – Indicates that the default namespace is "http://www.w3schools.com". • elementFormDefault="qualified“ – indicates that any elements used by XML instance document which were declared in this schema must be namespace qualified.
  • 16. What is a Simple Element? • A simple element is an XML element that can contain only text – It cannot contain any other elements or attributes. • Text can be of many different types. – It can be one of the types included in XML Schema definition (boolean, string, date, etc.), or – It can be a custom type that you can define yourself. • Syntax for defining a simple element is: <xs:element name="xxx" type="yyy"/>
  • 17. Most Common Types • XML Schema has a lot of built-in data types. • Most common types are:  xs:string  xs:decimal  xs:integer  xs:boolean  xs:date (YYYY-MM-DD)  xs:time (HH:MM:SS)
  • 18. Fixed Values for Simple Elements • A fixed value is automatically assigned to the element, – You cannot specify another value. • In the following example the fixed value is "red": <xs:element name="color"      type="xs:string" fixed="red"/>
  • 19. Default Values for Simple Elements • A default value is automatically assigned to the element – When no other value is specified. • In the following example the default value is "red": <xs:element name="color"      type="xs:string" default="red"/>
  • 20. XSD Attributes • Simple elements cannot have attributes. • If an element has attributes, – It is considered to be of a complex type. • But the attribute itself is always declared as a simple type. <xs:attribute name="xxx" type="yyy"/> xxx is the name of the attribute yyy specifies the data type of the attribute.
  • 21. Example of XSD Attributes • Here is an XML element with an attribute:        <lastname lang="EN">Smith</lastname> • And here is the corresponding attribute definition:      <xs:attribute name="lang" type="xs:string"/>
  • 22. Optional and Required Attributes • Attributes are optional by default. • To specify that the attribute is required, use the "use" attribute: <xs:attribute name="lang"       type="xs:string"                 use="required"/>
  • 23. Restrictions on Values • Example : Define an element called "age" with a restriction. – The value of age cannot be lower than 0 or greater than 120: <xs:element name="age">   <xs:simpleType>     <xs:restriction base="xs:integer">       <xs:minInclusive value="0"/>       <xs:maxInclusive value="120"/>     </xs:restriction>   </xs:simpleType> </xs:element>
  • 24. Restrictions on a Set of Values • Limit the content of XML element to a set of acceptable values – Use the enumeration constraint. • Ex : Define an element called "car" with a restriction. – The only acceptable values are: Audi, Golf, BMW: <xs:element name="age">   <xs:simpleType>     <xs:restriction base="xs:integer">       <xs:minInclusive value="0"/>       <xs:maxInclusive value="120"/>     </xs:restriction>   </xs:simpleType> </xs:element>
  • 25. Restrictions on a Series of Values • Ex : Defines an element called “letter" with a restriction. – Acceptable value is one of the LOWERCASE letters from a to z: <xs:restriction base="xs:string">       <xs:pattern value="[a-z]"/>
  • 26. Value must be min. 5 characters and max. 8 characters: Restrictions on Length Value must be exactly 8 characters: <xs:element name="password">   <xs:simpleType>     <xs:restriction base="xs:string">       <xs:length value="8"/>     </xs:restriction>   </xs:simpleType> </xs:element> <xs:element name="password">   <xs:simpleType>     <xs:restriction base="xs:string">       <xs:minLength value="5"/>       <xs:maxLength value="8"/>     </xs:restriction>   </xs:simpleType> </xs:element>
  • 28. XML Document Structure • An XML document consists of a number of discrete components • Not all the sections of an XML document may be necessary, – But their inclusion helps to make for a well-structured XML document • A well-structured XML document can – Easily be transported between systems and devices
  • 29. Major portions of an XML document • The major portions of an XML document include the following: – The XML declaration – The Document Type Declaration (DTD) – The element data – The attribute data – The character data or XML content
  • 30. XML Declaration • XML Declaration is a definite way of stating exactly – What the document contains. • XML document can optionally have an XML declaration – It must be the first statement of the XML document • XML declaration is a processing instruction of the form <?xml ...?>
  • 31. Components of XML Declaration Component Meaning <?xml Starts the beginning of the processing instruction Version= “xxx” Describes the specific version of XML being used standalone= “xxx” Defines whether documents are allowed to contain external markup declarations encoding= “xxx” Indicates the character encoding that the document uses. The default is “US-ASCII” but can be set to any value Example :
  • 32. Document Type Declaration (DTD) • A DTD defines the structure and the legal elements and attributes of an XML document. • An application can use a DTD to verify that XML data is valid. • If the DTD is declared inside the XML file, it must be wrapped inside the <!DOCTYPE> definition: • Document Type Declaration (DOCTYPE) gives a name to the XML content • A Document Type Declaration (DOCTYPE) – Names the document type and – Identifies the internal content
  • 33.
  • 34. OOA • OOA emphasis on – Finding and describing the objects (or concepts in the problem domain) • OOD emphasis on – Defining software What the system does (its static structure and behavior), • OOD focuses on – How the system does it (it’s run-time implementation).
  • 35. OOA • During OOA, the most important purpose is – To identify objects and describing them in a proper way. • Objects should be identified with responsibilities. • Responsibilities are the functions performed by the object. – Each and every object has some type of responsibilities to be performed. • When these responsibilities are collaborated the purpose of the system is fulfilled.
  • 36. OOD • Second phase is OOD. During this phase – Emphasis is given upon the requirements and their fulfillment. • In this stage, – The objects are collaborated according to their intended association. • After the association is complete the design is also complete. • Third phase is object oriented implementation. – In this phase the design is implemented using object oriented languages like Java, C++ etc.
  • 37. UML • OO design is transformed into UML diagrams according to the requirement. • Input from the OO analysis and design is the input to the UML diagrams. • UML is a modeling language used to model s/w and non s/w systems. • Although UML is used for non software systems – Emphasis is on modeling object oriented software applications.
  • 38. Conceptual model of UML • A conceptual model can be defined as – A model which is made of concepts and their relationships • A conceptual model is the first step before drawing a UML diagram. • It helps to – Understand the entities in the real world and how they interact with each other. • Conceptual model of UML can be mastered by learning the 3 major elements: 1. UML building blocks 2. Rules to connect the building blocks 3. Common mechanisms of UML
  • 39. UML building blocks • Three building blocks of UML are: – Things – Relationships – Diagrams
  • 40.
  • 41. Object • Object is a term used to represent a real world entity within the system being modeled • Objects has its own attributes and operations (methods). – Consider the real world object “Car” make = ford model = escape year = 2002 color = green maximum speed = 130 mph current speed = 50 mph accelerate () decelerate () refuel ()
  • 42. Network • During the OOA phase object-modeling techniques are used • To reflect the structure and behaviour of the system – A range of models can be created using such objects