SlideShare a Scribd company logo
UNIT I INTRODUCTION TO XML
XML document structure – Well formed and valid
documents – Namespaces – DTD – XML Schema
– X-Files.
XML Document Structure
Including all sections of an XML document
helps to make for a well-structured XML document
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 (DOCTYPE)
• DOCTYPE
– Gives a name to the XML content , and
– Provides a means to guarantee the document’s validity,
• Either by including or specifying a link to a Document Type Definition (DTD).
• DOCTYPE is optional in XML
• Valid XML documents must declare the document type to which they
comply
General Form of DOCTYPE
• General Forms of the Document Type Declarations
<!DOCTYPE NAME SYSTEM “file”>
<!DOCTYPE NAME [ ]>
<!DOCTYPE NAME SYSTEM “file” [ ]>
First form refers to
– A document that only allows use of an externally defined DTD subset.
Second declaration
– Only allows an internally defined subset within the document.
Last form provides
– A place for inclusion of an internally defined DTD subset b/w square brackets
while also making use of an external subset.
Example on DOCTYPE
• Example on First Forms
<!DOCTYPE shirt SYSTEM “shirt.dtd”>
– Root (first) tag in the document will be the <shirt> element
– DTD is saved to a file named shirt.dtd
Components of DOCTYPE
Markup and Content
• XML documents are composed of markup and content.
• In general, six kinds of markup can occur in an XML document:
– elements,
– entity references,
– comments,
– processing instructions,
– marked sections, and
– Document Type Declarations.
Elements
• XML elements are
– Either a matched pair of XML tags or single XML tags that are “self-closing.”
• For example,
– A shirt element begins with <shirt> and ends with </shirt>.
• When elements do not come in pairs,
– The element name is suffixed by the forward slash.
• The “unmatched” elements are known as empty elements
• Elements can be arbitrarily nested within other elements
Attributes
• Within elements,
Additional information can be communicated to XML processors
– That modifies the nature of the encapsulated content.
• Attributes are name/value pairs contained within the start element
– That can specify text strings that modify the context of the element.
• Example:
<price currency=”USD”>…</price>
<on_sale start_date=”10-15-2001”/>
Entity References
• Some characters have a special meaning in XML,
• Entity references indicate to XML-processing applications
– That a special text string is to follow that will be replaced with a different literal value,
• Entity references are delimited by
– An ampersand at the beginning and
– A semicolon at the ending.
• Ex : Inserting a > sign in our text
<descript> Following says 8 is greater than 5 </descript>
<equation>4 &gt; 5</equation>
Major Entity References Character
&lt; <
&gt; >
&amp; &
&quot; "
&apos; '
Comments
• Comments can be placed anywhere in a document and
– They are not considered to be part of the textual content of an XML document.
• Character sequence <!-- begins a comment and --> ends the comment.
• B/w these 2 delimiters,
– Any text at all can be written, including valid XML markup.
• Only restriction is that
– Comment delimiters cannot be used; neither can the literal string --.
• Example :
<!-- The below element talks about Elephant I once owned... -->
<animal>Elephant</animal>
Processing Instructions (PIs)
• PIs are not a textual part of an XML document
– But provide information to applications as to how the content should be processed.
• Unlike comments, XML processors are required to pass along PIs.
• Processing instructions have the following form:
<?instruction options?>
• Instruction name is called the PI target
– It is a special identifier that the processing application is intended to understand.
• Any following information can be optionally specified
• Example: <?send-message “process complete”?>
Marked CDATA Sections
• Some documents will contain a large number of characters and text
– That an XML processor should ignore and pass to an application.
• These are known as character data (or CDATA) sections.
• Within an XML document, a CDATA section instructs the parser
– To ignore all markup characters except the end of the CDATA markup instruction.
• This allows for a section of XML code to be “escaped”
– So that it doesn’t inadvertently disrupt XML processing.
• CDATA sections follow this general form:
<![CDATA[content]]>
Marked CDATA Sections
• All content contained in the CDATA section is
– Passed as string literals directly to the application without interpretation
• Example:
<object_code>
<![CDATA[
function master(poltice integer) {
if poltice<=3 then {
Mas=poltice+IntToString(FindElement(“<chicken>”));
}
}
]]>
</object_code>
Document Type Definitions (DTD)
• Don’t confuse the DOCTYPE with the DTD.
• A DOCTYPE and a DTD serve very different, although related purposes.
– DOCTYPE is used to identify and name the XML content
– DTD is used to validate the metadata contained within.
• DTDs represent a specific form of XML text
– That is allowable in an XML document.
• DTDs and XML Schema are the means for defining the validity constraints
on XML documents
XML Content
• XML content can consist of any data, including binary data,
– As long as it doesn’t violate rules that would confuse the content with valid XML
metadata instructions.
• XML content can contain any characters,
– Including any valid Unicode and international characters.
• XML content can be as long as necessary
01 xml document structure
XML document with an internal DTD
• A DTD defines the structure & 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
Document Type Declaration (DOCTYPE)
• A DTD defines the structure & 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
01 xml document structure
Ad

More Related Content

What's hot (20)

10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMS
koolkampus
 
XML Document Object Model (DOM)
XML Document Object Model (DOM)XML Document Object Model (DOM)
XML Document Object Model (DOM)
BOSS Webtech
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
BIT Durg
 
Xml dtd
Xml dtdXml dtd
Xml dtd
sana mateen
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
Katrien Verbert
 
Xpath presentation
Xpath presentationXpath presentation
Xpath presentation
Alfonso Gabriel López Ceballos
 
XSLT
XSLTXSLT
XSLT
Kamal Acharya
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
Jeff Fox
 
Multimedia Database
Multimedia Database Multimedia Database
Multimedia Database
Avnish Patel
 
Specification-of-tokens
Specification-of-tokensSpecification-of-tokens
Specification-of-tokens
Dattatray Gandhmal
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
United International University
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
yht4ever
 
Servlet life cycle
Servlet life cycleServlet life cycle
Servlet life cycle
Venkateswara Rao N
 
CS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network SecurityCS8792 - Cryptography and Network Security
CS8792 - Cryptography and Network Security
vishnukp34
 
DTD
DTDDTD
DTD
Kamal Acharya
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
Akhil Kaushik
 
IOT Reference Model.doc
IOT Reference Model.docIOT Reference Model.doc
IOT Reference Model.doc
venui2
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
Jussi Pohjolainen
 
anatomy of a jsp page & jsp syntax.pptx
anatomy of a jsp page & jsp syntax.pptxanatomy of a jsp page & jsp syntax.pptx
anatomy of a jsp page & jsp syntax.pptx
Sameenafathima4
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
OECLIB Odisha Electronics Control Library
 

Similar to 01 xml document structure (20)

M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5   XMLM.FLORENCE DAYANA WEB DESIGN -Unit 5   XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
Dr.Florence Dayana
 
Ch2 neworder
Ch2 neworderCh2 neworder
Ch2 neworder
davidlahr32
 
web program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.pptweb program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
Dr.Saranya K.G
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
Swati Parmar
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
manochitra10
 
XML-Unit 1.ppt
XML-Unit 1.pptXML-Unit 1.ppt
XML-Unit 1.ppt
ssuseree7dcd
 
chapter 4 web authoring unit 4 xml.pptx
chapter 4 web authoring  unit 4 xml.pptxchapter 4 web authoring  unit 4 xml.pptx
chapter 4 web authoring unit 4 xml.pptx
amare63
 
GRADE 12 UNIT 4 computer science Ethiopian.pptx
GRADE 12 UNIT 4 computer science Ethiopian.pptxGRADE 12 UNIT 4 computer science Ethiopian.pptx
GRADE 12 UNIT 4 computer science Ethiopian.pptx
ElanPuthukkudi
 
Web Technology Part 4
Web Technology Part 4Web Technology Part 4
Web Technology Part 4
Thapar Institute
 
Internet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptxInternet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
IT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notesIT6801-Service Oriented Architecture- UNIT-I notes
IT6801-Service Oriented Architecture- UNIT-I notes
Ramco Institute of Technology, Rajapalayam, Tamilnadu, India
 
Xml 1
Xml 1Xml 1
Xml 1
pavishkumarsingh
 
XML DTD DOCUMENT TYPE DEFINITION
XML DTD DOCUMENT TYPE DEFINITIONXML DTD DOCUMENT TYPE DEFINITION
XML DTD DOCUMENT TYPE DEFINITION
SaraswathiRamalingam
 
Xml
XmlXml
Xml
soumya
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
shannonsdavis
 
Web Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdfWeb Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdf
AnonymousXhmybK
 
Xml basics
Xml basicsXml basics
Xml basics
Kumar
 
Intro to xml
Intro to xmlIntro to xml
Intro to xml
Tarun Jain
 
II UNIT PPT NOTES.pdf this is the data structures
II UNIT PPT NOTES.pdf this is the data structuresII UNIT PPT NOTES.pdf this is the data structures
II UNIT PPT NOTES.pdf this is the data structures
PriyankaRamavath3
 
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5   XMLM.FLORENCE DAYANA WEB DESIGN -Unit 5   XML
M.FLORENCE DAYANA WEB DESIGN -Unit 5 XML
Dr.Florence Dayana
 
web program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.pptweb program-Extended MARKUP Language XML.ppt
web program-Extended MARKUP Language XML.ppt
mcjaya2024
 
chapter 4 web authoring unit 4 xml.pptx
chapter 4 web authoring  unit 4 xml.pptxchapter 4 web authoring  unit 4 xml.pptx
chapter 4 web authoring unit 4 xml.pptx
amare63
 
GRADE 12 UNIT 4 computer science Ethiopian.pptx
GRADE 12 UNIT 4 computer science Ethiopian.pptxGRADE 12 UNIT 4 computer science Ethiopian.pptx
GRADE 12 UNIT 4 computer science Ethiopian.pptx
ElanPuthukkudi
 
Internet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptxInternet_Technology_UNIT V- Introduction to XML.pptx
Internet_Technology_UNIT V- Introduction to XML.pptx
shilpar780389
 
Web Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdfWeb Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdf
AnonymousXhmybK
 
Xml basics
Xml basicsXml basics
Xml basics
Kumar
 
II UNIT PPT NOTES.pdf this is the data structures
II UNIT PPT NOTES.pdf this is the data structuresII UNIT PPT NOTES.pdf this is the data structures
II UNIT PPT NOTES.pdf this is the data structures
PriyankaRamavath3
 
Ad

More from Baskarkncet (20)

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

Recently uploaded (20)

ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Journal of Soft Computing in Civil Engineering
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Using the Artificial Neural Network to Predict the Axial Strength and Strain ...
Journal of Soft Computing in Civil Engineering
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control
 
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
AI Publications
 
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
Guru Nanak Technical Institutions
 
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
JRR Tolkien’s Lord of the Rings: Was It Influenced by Nordic Mythology, Homer...
Reflections on Morality, Philosophy, and History
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Lecture - 7 Canals of the topic of the civil engineering
Lecture - 7  Canals of the topic of the civil engineeringLecture - 7  Canals of the topic of the civil engineering
Lecture - 7 Canals of the topic of the civil engineering
MJawadkhan1
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
AI Publications
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 

01 xml document structure

  • 1. UNIT I INTRODUCTION TO XML XML document structure – Well formed and valid documents – Namespaces – DTD – XML Schema – X-Files.
  • 2. XML Document Structure Including all sections of an XML document helps to make for a well-structured XML document
  • 3. 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
  • 4. 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
  • 5. 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 ...?>
  • 6. 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 :
  • 7. Document Type Declaration (DOCTYPE) • DOCTYPE – Gives a name to the XML content , and – Provides a means to guarantee the document’s validity, • Either by including or specifying a link to a Document Type Definition (DTD). • DOCTYPE is optional in XML • Valid XML documents must declare the document type to which they comply
  • 8. General Form of DOCTYPE • General Forms of the Document Type Declarations <!DOCTYPE NAME SYSTEM “file”> <!DOCTYPE NAME [ ]> <!DOCTYPE NAME SYSTEM “file” [ ]> First form refers to – A document that only allows use of an externally defined DTD subset. Second declaration – Only allows an internally defined subset within the document. Last form provides – A place for inclusion of an internally defined DTD subset b/w square brackets while also making use of an external subset.
  • 9. Example on DOCTYPE • Example on First Forms <!DOCTYPE shirt SYSTEM “shirt.dtd”> – Root (first) tag in the document will be the <shirt> element – DTD is saved to a file named shirt.dtd
  • 11. Markup and Content • XML documents are composed of markup and content. • In general, six kinds of markup can occur in an XML document: – elements, – entity references, – comments, – processing instructions, – marked sections, and – Document Type Declarations.
  • 12. Elements • XML elements are – Either a matched pair of XML tags or single XML tags that are “self-closing.” • For example, – A shirt element begins with <shirt> and ends with </shirt>. • When elements do not come in pairs, – The element name is suffixed by the forward slash. • The “unmatched” elements are known as empty elements • Elements can be arbitrarily nested within other elements
  • 13. Attributes • Within elements, Additional information can be communicated to XML processors – That modifies the nature of the encapsulated content. • Attributes are name/value pairs contained within the start element – That can specify text strings that modify the context of the element. • Example: <price currency=”USD”>…</price> <on_sale start_date=”10-15-2001”/>
  • 14. Entity References • Some characters have a special meaning in XML, • Entity references indicate to XML-processing applications – That a special text string is to follow that will be replaced with a different literal value, • Entity references are delimited by – An ampersand at the beginning and – A semicolon at the ending. • Ex : Inserting a > sign in our text <descript> Following says 8 is greater than 5 </descript> <equation>4 &gt; 5</equation> Major Entity References Character &lt; < &gt; > &amp; & &quot; " &apos; '
  • 15. Comments • Comments can be placed anywhere in a document and – They are not considered to be part of the textual content of an XML document. • Character sequence <!-- begins a comment and --> ends the comment. • B/w these 2 delimiters, – Any text at all can be written, including valid XML markup. • Only restriction is that – Comment delimiters cannot be used; neither can the literal string --. • Example : <!-- The below element talks about Elephant I once owned... --> <animal>Elephant</animal>
  • 16. Processing Instructions (PIs) • PIs are not a textual part of an XML document – But provide information to applications as to how the content should be processed. • Unlike comments, XML processors are required to pass along PIs. • Processing instructions have the following form: <?instruction options?> • Instruction name is called the PI target – It is a special identifier that the processing application is intended to understand. • Any following information can be optionally specified • Example: <?send-message “process complete”?>
  • 17. Marked CDATA Sections • Some documents will contain a large number of characters and text – That an XML processor should ignore and pass to an application. • These are known as character data (or CDATA) sections. • Within an XML document, a CDATA section instructs the parser – To ignore all markup characters except the end of the CDATA markup instruction. • This allows for a section of XML code to be “escaped” – So that it doesn’t inadvertently disrupt XML processing. • CDATA sections follow this general form: <![CDATA[content]]>
  • 18. Marked CDATA Sections • All content contained in the CDATA section is – Passed as string literals directly to the application without interpretation • Example: <object_code> <![CDATA[ function master(poltice integer) { if poltice<=3 then { Mas=poltice+IntToString(FindElement(“<chicken>”)); } } ]]> </object_code>
  • 19. Document Type Definitions (DTD) • Don’t confuse the DOCTYPE with the DTD. • A DOCTYPE and a DTD serve very different, although related purposes. – DOCTYPE is used to identify and name the XML content – DTD is used to validate the metadata contained within. • DTDs represent a specific form of XML text – That is allowable in an XML document. • DTDs and XML Schema are the means for defining the validity constraints on XML documents
  • 20. XML Content • XML content can consist of any data, including binary data, – As long as it doesn’t violate rules that would confuse the content with valid XML metadata instructions. • XML content can contain any characters, – Including any valid Unicode and international characters. • XML content can be as long as necessary
  • 22. XML document with an internal DTD • A DTD defines the structure & 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
  • 23. Document Type Declaration (DOCTYPE) • A DTD defines the structure & 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
  翻译: