SlideShare a Scribd company logo
Document Type
Definition
DTD
Document Tvpe Definitions
(DTDs) define an XML document's structure (e.g., what elements,attributes, etc. are permitted
in the document). An XML document is not required to have a corresponding DTD. However,
DTDs are often recommended to ensure document conformity, especially in business-to-
business (B2B) transactions, where XML documents are exchanged. DTDs specify an XML
document's structure and are themselves defined using EBNF (Extended Backus-Naur Form)
grammar-not the XML syntax.
Observation:
A transition is underway in the XML community from DTDs to Schema, which improve upon
DTDs. Schema use XML syntax, not EBNF grammar.
Parsers, Well-formed and Valid XML Documents:
Parsers are generally classified as validating or nonvalidating. A validating parser is able to read
the DTD and determine whether or not the XML document conforms to it. If the document
conforms to the DTD, it is referred to as valid. If the document fails to conform to the DTD but
is syntactically correct, it is well formed but not valid. By definition, a valid document is well
formed. A nonvalidating parser is able to read the DTD, but cannot check the document against
the DTD for conformity. If the document is syntactically correct, it is well formed.
Document Type Declaration
DTDs are introduced into XML documents using the document type declaration (i.e .DOCTYPE).
A document type declaration is placed in the XML document's prolog and begins with
<!DOCTYPE and ends with >. The document type declaration can point to declarations
that are outside the XML document (called the external subset) or can contain the declaration
inside the document (called internal subset).
For example, an internal subset mightlook like
<!DOCTYPE myMessage [
<!ELEMENT myMessage ( #PCDATA )>
]
The first myMessage
is the name of the document type declaration. Anything inside the square brackets ( [ ] )
constitutes the internal subset. As we will see momentarily,
ELEMENT and
#PCDATA are used in "element declarations.“
External subsets physically exist in a different file that typically ends with the .
Dtd extension,although this file extension is not required. External subsets are specified using
either keyword SYSTEM or PUBLIC.
For example. the
DOCTYPE
external subset might look like
<!DOCTYPE myMessage SYSTEM "myDTD.dtd">
which points to the myDTD.dtd document. Using the PUBLIC
keyword indicates that the DTD is widely used (e.g., the DTD for HTML documents). The DTD
may be made available in well-known locations for more efficient downloading. The
DOCTYPE
<!DOCTYPE HTML PUBLIC "-//w3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
uses the PUBLIC
keyword to reference the well-known DTD for HTML version 4.01. XML parsers that do not have
a local copy of the DTD may use the URL provided to download the DTD to perform validation
Both the internal and external subset may be specified at the same time. For example, the
DOCTYPE
<!DOCTYPE myMessage SYSTEM "myDTD.dtd“ <!ELEMENT myElement ( #PCDATA )>
contains declarations from the myDTD.dtd document as well as an internal declaration
Observation:
The document type declaration internal subset plus its external subset form the DTD.
The internal subset is visible only within the document in which it resides. Other external
documents cannot be validated against it. DTDs that are used by many documents should be
placed in the external subset.
Element Type Declarations
Elements are the primary building block used in XML documents and are declared in a DTD
with element type declarations (ELEMENTs). For example, to declare element myMessage,
we might write
The element name (e.g., MyElement) that follows ELEMENT is often called a generic identifier.
The set of parentheses that follow the element name specify the element's allowed content and
is called the content specification.
Keyword
PCDATA
specifies that the element must contain parsable character data. This data will be parsed by the
XML parser, therefore any markup text (i.e., <, >, &, etc.) will be treated as markup.
Error:
Attempting to use the same element name in multiple element type declarations is an error.
Example 1 lists an XML document that contains a reference to an external DTD in the
I)DOCTYPE.
Microsoft's XML Validator will be used to check the document's conformity
against its DTD. To use XML Validator, Internet Explorer 5 is required. Parsers XML4J and
Xerces can be used to check a document's validity against a DTD programmatically. Using Java
and one of these parsers provides a platform-independent way to validate XML documents.
<?xml version = "1.0"?>
<!DOCTYPE myMessage SYSTEM "intro.dtd">
<myMessage>
<message>Welcome to XML!</message>
</myMessage>
Example 1. XML document declaring associated DTD.
The document type declaration is named myMessage-the name of the root element. The
element myMessage contains a single child element named message .
<!ELEMENT myMessage ( message )> <!ELEMENT message ( #PCDATA )> Example 2. Validation
with using an external DTD The DTD declares element myMessage.
Notice that the content specification contains the name message. This indicates that element
myMessage contains exactly one child element named message. Because myMessage can only
have an element as its content, it is said to have element content. Element message whose
content is of type PCDATA. The XML Validator is capable of validating an XML document against
both DTDs and Schemas
Error:
Having a root element name other than the name specified in the document type declaration is
an error.
Document Type Definitions (DTDs) define an XML document's structure (e.g., what
elements, attributes, etc. are permitted in the XML document). An XML document is not
required to have a corresponding DTD. DTDs use EBNF (Extended Backus-Naur Form)
grammar
Parsers are generally classified as validating or nonvalidating. A validating parser is able to
read the DTD and determine whether or not the XML document conforms to it. If the
document conforms to the DTD, it is referred to as valid. If the document fails to conform to
the DTD but is syntactically correct, it is well formed but not valid. By definition, a valid
document is well formed.
A nonvalidating parser is able to read a DTD, but cannot check the document against the
DTD for conformity. If the document is syntactically correct, it is well formed.
DTDs are introduced into XML documents by using the document type declaration (i.e.,
DOCTYPE). The document type declaration can point to declarations that are outside the
XML document (called the external subset) or can contain the declaration inside the
document (called internal subset).
External subsets physically exist in a different file that typically ends with the .dtd
extension, although this file extension is not required. External Subsets are specified using
keyword SYSTEM. Both the internal and external subset may be specified at the same
time
Elements are the primary building block used in XML documents and are declared in a
DTD with element type declarations (ELEMENTs).
The element name that follows ELEMENT is often called a generic identifier. The set of
parentheses that follow the element name specify the element's allowed content and is
called the content specification.
Keyword PCDATA
specifies that the element must contain parsable character data-that is,any text except the
characters less-than ( < ), greater-than ( > ), ampersand ( & ), quote ( ' ) and double quote ( " ).
An XML document is a standalone XML document if it does not reference an external DTD.
An XML element that can only have another element for content, it is said to have element
content.
DTDs allow the document author to define the order and frequency of child elements. The
comma ( , ) - called a sequence - specifies the order in which the elements must occur.
Choices are specified using the pipe ( | ) character. The content specification may contain
any number of pipe character separated choises.
An element's frequency (i.e., number of occurrences) is specified by using either the plus
sign (+), asterisk (*) or question mark (?) occurrence indicator
The frequency of an element group (i.e., two or more elements that occur in some
combinaition) is specified by enclosing the element names inside the content specification
followed by an occurrence indicator
Elements can be further refined by describing the content types they may contain. Content
specification types (e.g., EMPTY, mixed content, ANY, etc.) describe nonelement content.
An element can be declared as having mixed content (i.e., a combination of elements and
PCDATA). The comma ( , ), plus sign ( + ) and question mark ( ? ) occurrence indicators
cannot be used with mixed content elements

More Related Content

PPT
Document Type Definition
yht4ever
 
PPT
Dtd
vikram singh
 
PPT
2 dtd - validating xml documents
gauravashq
 
PPTX
Xml dtd
HeenaRajput1
 
PPTX
XML's validation - DTD
videde_group
 
PPTX
Xml dtd
sana mateen
 
Document Type Definition
yht4ever
 
2 dtd - validating xml documents
gauravashq
 
Xml dtd
HeenaRajput1
 
XML's validation - DTD
videde_group
 
Xml dtd
sana mateen
 

What's hot (20)

PPT
Introduction to XML
yht4ever
 
PDF
Introduction to DTD
torp42
 
PPTX
Xml dtd- Document Type Definition- Web Technology
Rajan Shah
 
PPTX
DTD
Kumar
 
PPTX
Document type definitions part 1
Randy Riness @ South Puget Sound Community College
 
PDF
Difference between dtd and xsd
Umar Ali
 
PPT
XML and DTD
Jussi Pohjolainen
 
PPTX
DTD
Kamal Acharya
 
PPT
Xml Java
cbee48
 
PDF
SQL Server - Querying and Managing XML Data
Marek Maśko
 
PPTX
XML Introduction
Bikash chhetri
 
PPT
4 xml namespaces and xml schema
gauravashq
 
PPT
01 xml document structure
Baskarkncet
 
PPT
3 xml namespaces and xml schema
gauravashq
 
PPT
XML Schema
yht4ever
 
PPTX
Xml For Dummies Chapter 8 Understanding And Using Dt Ds it-slideshares.blog...
phanleson
 
PPTX
XML, DTD & XSD Overview
Pradeep Rapolu
 
PPTX
Basic XML
Hoang Nguyen
 
Introduction to XML
yht4ever
 
Introduction to DTD
torp42
 
Xml dtd- Document Type Definition- Web Technology
Rajan Shah
 
DTD
Kumar
 
Document type definitions part 1
Randy Riness @ South Puget Sound Community College
 
Difference between dtd and xsd
Umar Ali
 
XML and DTD
Jussi Pohjolainen
 
Xml Java
cbee48
 
SQL Server - Querying and Managing XML Data
Marek Maśko
 
XML Introduction
Bikash chhetri
 
4 xml namespaces and xml schema
gauravashq
 
01 xml document structure
Baskarkncet
 
3 xml namespaces and xml schema
gauravashq
 
XML Schema
yht4ever
 
Xml For Dummies Chapter 8 Understanding And Using Dt Ds it-slideshares.blog...
phanleson
 
XML, DTD & XSD Overview
Pradeep Rapolu
 
Basic XML
Hoang Nguyen
 
Ad

Viewers also liked (20)

PPTX
Different document types
Breach_P
 
PPS
Documentation Types
Raghunath (Gautam) Soman
 
PPTX
Tablas html
KarySandovalP
 
PPTX
HTML Link - Image - Comments
Hameda Hurmat
 
PPT
Hyperlinks in HTML
Aarti P
 
PPTX
XML Document Object Model (DOM)
BOSS Webtech
 
PPSX
CSS-Cascading Style Sheets - Introduction
Mukesh Tekwani
 
PDF
Html table tags
eShikshak
 
PPT
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
PPTX
Images and Lists in HTML
Marlon Jamera
 
PDF
SharePoint Document Types
Gregory Zelfond
 
PPT
Css Ppt
Hema Prasanth
 
PPT
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
PPT
Introduction to CSS
Amit Tyagi
 
PPT
cascading style sheet ppt
abhilashagupta
 
PPT
Introduction to html
vikasgaur31
 
PDF
International Trade Documents: 10 Top Documents
Global Negotiator
 
PPT
Html Ppt
vijayanit
 
PPT
Introduction to HTML
MayaLisa
 
PPTX
Types of contract
Sweetp999
 
Different document types
Breach_P
 
Documentation Types
Raghunath (Gautam) Soman
 
Tablas html
KarySandovalP
 
HTML Link - Image - Comments
Hameda Hurmat
 
Hyperlinks in HTML
Aarti P
 
XML Document Object Model (DOM)
BOSS Webtech
 
CSS-Cascading Style Sheets - Introduction
Mukesh Tekwani
 
Html table tags
eShikshak
 
How Cascading Style Sheets (CSS) Works
Amit Tyagi
 
Images and Lists in HTML
Marlon Jamera
 
SharePoint Document Types
Gregory Zelfond
 
Css Ppt
Hema Prasanth
 
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
Introduction to CSS
Amit Tyagi
 
cascading style sheet ppt
abhilashagupta
 
Introduction to html
vikasgaur31
 
International Trade Documents: 10 Top Documents
Global Negotiator
 
Html Ppt
vijayanit
 
Introduction to HTML
MayaLisa
 
Types of contract
Sweetp999
 
Ad

Similar to Document type definition (20)

PPTX
XML DTD DOCUMENT TYPE DEFINITION
SaraswathiRamalingam
 
PPTX
Unit iv xml
smitha273566
 
PPT
2-DTD.ppt
KGSCSEPSGCT
 
PPTX
It8074 soa-unit i
smitha273566
 
PDF
it8074-soa-uniti-.pdf
FreeFire293813
 
PPTX
It8074 soa-unit i
RevathiAPICSE
 
PPT
uptu web technology unit 2 Xml2
Abhishek Kesharwani
 
PPTX
DTD1.pptx
MouDhara1
 
PPT
Ch2 neworder
davidlahr32
 
PPTX
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
VijiPriya Jeyamani
 
PPTX
distributed system concerned lab sessions
milkesa13
 
PPTX
XML DTD and Schema
hamsa nandhini
 
PPTX
web design technology- mark up languages
ssuser2efca7
 
PPT
Xml and webdata
Harry Potter
 
PPT
Xml and webdata
Luis Goldster
 
PPT
Xml and webdata
Young Alista
 
PPT
Xml and webdata
James Wong
 
XML DTD DOCUMENT TYPE DEFINITION
SaraswathiRamalingam
 
Unit iv xml
smitha273566
 
2-DTD.ppt
KGSCSEPSGCT
 
It8074 soa-unit i
smitha273566
 
it8074-soa-uniti-.pdf
FreeFire293813
 
It8074 soa-unit i
RevathiAPICSE
 
uptu web technology unit 2 Xml2
Abhishek Kesharwani
 
DTD1.pptx
MouDhara1
 
Ch2 neworder
davidlahr32
 
IPT Chapter 3 Data Mapping and Exchange - Dr. J. VijiPriya
VijiPriya Jeyamani
 
distributed system concerned lab sessions
milkesa13
 
XML DTD and Schema
hamsa nandhini
 
web design technology- mark up languages
ssuser2efca7
 
Xml and webdata
Harry Potter
 
Xml and webdata
Luis Goldster
 
Xml and webdata
Young Alista
 
Xml and webdata
James Wong
 

More from Raghu nath (20)

PPTX
Mongo db
Raghu nath
 
PDF
Ftp (file transfer protocol)
Raghu nath
 
PDF
MS WORD 2013
Raghu nath
 
PDF
Msword
Raghu nath
 
PDF
Ms word
Raghu nath
 
PDF
Javascript part1
Raghu nath
 
PDF
Regular expressions
Raghu nath
 
PDF
Selection sort
Raghu nath
 
PPTX
Binary search
Raghu nath
 
PPTX
JSON(JavaScript Object Notation)
Raghu nath
 
PDF
Stemming algorithms
Raghu nath
 
PPTX
Step by step guide to install dhcp role
Raghu nath
 
PPTX
Network essentials chapter 4
Raghu nath
 
PPTX
Network essentials chapter 3
Raghu nath
 
PPTX
Network essentials chapter 2
Raghu nath
 
PPTX
Network essentials - chapter 1
Raghu nath
 
PPTX
Python chapter 2
Raghu nath
 
PPTX
python chapter 1
Raghu nath
 
PPTX
Linux Shell Scripting
Raghu nath
 
PPTX
Perl
Raghu nath
 
Mongo db
Raghu nath
 
Ftp (file transfer protocol)
Raghu nath
 
MS WORD 2013
Raghu nath
 
Msword
Raghu nath
 
Ms word
Raghu nath
 
Javascript part1
Raghu nath
 
Regular expressions
Raghu nath
 
Selection sort
Raghu nath
 
Binary search
Raghu nath
 
JSON(JavaScript Object Notation)
Raghu nath
 
Stemming algorithms
Raghu nath
 
Step by step guide to install dhcp role
Raghu nath
 
Network essentials chapter 4
Raghu nath
 
Network essentials chapter 3
Raghu nath
 
Network essentials chapter 2
Raghu nath
 
Network essentials - chapter 1
Raghu nath
 
Python chapter 2
Raghu nath
 
python chapter 1
Raghu nath
 
Linux Shell Scripting
Raghu nath
 

Recently uploaded (20)

PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Virus sequence retrieval from NCBI database
yamunaK13
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
Basics and rules of probability with real-life uses
ravatkaran694
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 

Document type definition

  • 2. Document Tvpe Definitions (DTDs) define an XML document's structure (e.g., what elements,attributes, etc. are permitted in the document). An XML document is not required to have a corresponding DTD. However, DTDs are often recommended to ensure document conformity, especially in business-to- business (B2B) transactions, where XML documents are exchanged. DTDs specify an XML document's structure and are themselves defined using EBNF (Extended Backus-Naur Form) grammar-not the XML syntax.
  • 3. Observation: A transition is underway in the XML community from DTDs to Schema, which improve upon DTDs. Schema use XML syntax, not EBNF grammar. Parsers, Well-formed and Valid XML Documents: Parsers are generally classified as validating or nonvalidating. A validating parser is able to read the DTD and determine whether or not the XML document conforms to it. If the document conforms to the DTD, it is referred to as valid. If the document fails to conform to the DTD but is syntactically correct, it is well formed but not valid. By definition, a valid document is well formed. A nonvalidating parser is able to read the DTD, but cannot check the document against the DTD for conformity. If the document is syntactically correct, it is well formed.
  • 4. Document Type Declaration DTDs are introduced into XML documents using the document type declaration (i.e .DOCTYPE). A document type declaration is placed in the XML document's prolog and begins with <!DOCTYPE and ends with >. The document type declaration can point to declarations that are outside the XML document (called the external subset) or can contain the declaration inside the document (called internal subset). For example, an internal subset mightlook like
  • 5. <!DOCTYPE myMessage [ <!ELEMENT myMessage ( #PCDATA )> ]
  • 6. The first myMessage is the name of the document type declaration. Anything inside the square brackets ( [ ] ) constitutes the internal subset. As we will see momentarily, ELEMENT and #PCDATA are used in "element declarations.“
  • 7. External subsets physically exist in a different file that typically ends with the . Dtd extension,although this file extension is not required. External subsets are specified using either keyword SYSTEM or PUBLIC. For example. the DOCTYPE external subset might look like
  • 8. <!DOCTYPE myMessage SYSTEM "myDTD.dtd"> which points to the myDTD.dtd document. Using the PUBLIC keyword indicates that the DTD is widely used (e.g., the DTD for HTML documents). The DTD may be made available in well-known locations for more efficient downloading. The DOCTYPE
  • 9. <!DOCTYPE HTML PUBLIC "-//w3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> uses the PUBLIC keyword to reference the well-known DTD for HTML version 4.01. XML parsers that do not have a local copy of the DTD may use the URL provided to download the DTD to perform validation Both the internal and external subset may be specified at the same time. For example, the DOCTYPE
  • 10. <!DOCTYPE myMessage SYSTEM "myDTD.dtd“ <!ELEMENT myElement ( #PCDATA )> contains declarations from the myDTD.dtd document as well as an internal declaration
  • 11. Observation: The document type declaration internal subset plus its external subset form the DTD. The internal subset is visible only within the document in which it resides. Other external documents cannot be validated against it. DTDs that are used by many documents should be placed in the external subset.
  • 12. Element Type Declarations Elements are the primary building block used in XML documents and are declared in a DTD with element type declarations (ELEMENTs). For example, to declare element myMessage, we might write
  • 13. The element name (e.g., MyElement) that follows ELEMENT is often called a generic identifier. The set of parentheses that follow the element name specify the element's allowed content and is called the content specification. Keyword PCDATA specifies that the element must contain parsable character data. This data will be parsed by the XML parser, therefore any markup text (i.e., <, >, &, etc.) will be treated as markup.
  • 14. Error: Attempting to use the same element name in multiple element type declarations is an error. Example 1 lists an XML document that contains a reference to an external DTD in the I)DOCTYPE. Microsoft's XML Validator will be used to check the document's conformity against its DTD. To use XML Validator, Internet Explorer 5 is required. Parsers XML4J and
  • 15. Xerces can be used to check a document's validity against a DTD programmatically. Using Java and one of these parsers provides a platform-independent way to validate XML documents. <?xml version = "1.0"?> <!DOCTYPE myMessage SYSTEM "intro.dtd"> <myMessage> <message>Welcome to XML!</message> </myMessage> Example 1. XML document declaring associated DTD.
  • 16. The document type declaration is named myMessage-the name of the root element. The element myMessage contains a single child element named message . <!ELEMENT myMessage ( message )> <!ELEMENT message ( #PCDATA )> Example 2. Validation with using an external DTD The DTD declares element myMessage. Notice that the content specification contains the name message. This indicates that element myMessage contains exactly one child element named message. Because myMessage can only have an element as its content, it is said to have element content. Element message whose content is of type PCDATA. The XML Validator is capable of validating an XML document against both DTDs and Schemas
  • 17. Error: Having a root element name other than the name specified in the document type declaration is an error.
  • 18. Document Type Definitions (DTDs) define an XML document's structure (e.g., what elements, attributes, etc. are permitted in the XML document). An XML document is not required to have a corresponding DTD. DTDs use EBNF (Extended Backus-Naur Form) grammar
  • 19. Parsers are generally classified as validating or nonvalidating. A validating parser is able to read the DTD and determine whether or not the XML document conforms to it. If the document conforms to the DTD, it is referred to as valid. If the document fails to conform to the DTD but is syntactically correct, it is well formed but not valid. By definition, a valid document is well formed.
  • 20. A nonvalidating parser is able to read a DTD, but cannot check the document against the DTD for conformity. If the document is syntactically correct, it is well formed.
  • 21. DTDs are introduced into XML documents by using the document type declaration (i.e., DOCTYPE). The document type declaration can point to declarations that are outside the XML document (called the external subset) or can contain the declaration inside the document (called internal subset).
  • 22. External subsets physically exist in a different file that typically ends with the .dtd extension, although this file extension is not required. External Subsets are specified using keyword SYSTEM. Both the internal and external subset may be specified at the same time
  • 23. Elements are the primary building block used in XML documents and are declared in a DTD with element type declarations (ELEMENTs). The element name that follows ELEMENT is often called a generic identifier. The set of parentheses that follow the element name specify the element's allowed content and is called the content specification.
  • 24. Keyword PCDATA specifies that the element must contain parsable character data-that is,any text except the characters less-than ( < ), greater-than ( > ), ampersand ( & ), quote ( ' ) and double quote ( " ). An XML document is a standalone XML document if it does not reference an external DTD. An XML element that can only have another element for content, it is said to have element content.
  • 25. DTDs allow the document author to define the order and frequency of child elements. The comma ( , ) - called a sequence - specifies the order in which the elements must occur. Choices are specified using the pipe ( | ) character. The content specification may contain any number of pipe character separated choises.
  • 26. An element's frequency (i.e., number of occurrences) is specified by using either the plus sign (+), asterisk (*) or question mark (?) occurrence indicator
  • 27. The frequency of an element group (i.e., two or more elements that occur in some combinaition) is specified by enclosing the element names inside the content specification followed by an occurrence indicator Elements can be further refined by describing the content types they may contain. Content specification types (e.g., EMPTY, mixed content, ANY, etc.) describe nonelement content.
  • 28. An element can be declared as having mixed content (i.e., a combination of elements and PCDATA). The comma ( , ), plus sign ( + ) and question mark ( ? ) occurrence indicators cannot be used with mixed content elements