SlideShare ist ein Scribd-Unternehmen logo
1 von 24
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
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

Weitere ähnliche Inhalte

Was ist angesagt?

Unit 01 dbms
Unit 01 dbmsUnit 01 dbms
Unit 01 dbms
anuragmbst
 
Introduction to XHTML
Introduction to XHTMLIntroduction to XHTML
Introduction to XHTML
Hend Al-Khalifa
 
Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databases
ArangoDB Database
 

Was ist angesagt? (20)

Html ppt
Html pptHtml ppt
Html ppt
 
Css borders
Css bordersCss borders
Css borders
 
Structure of dbms
Structure of dbmsStructure of dbms
Structure of dbms
 
Unit 01 dbms
Unit 01 dbmsUnit 01 dbms
Unit 01 dbms
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
 
Html
HtmlHtml
Html
 
Introduction to XHTML
Introduction to XHTMLIntroduction to XHTML
Introduction to XHTML
 
Dtd
DtdDtd
Dtd
 
Web html table tags
Web html  table tagsWeb html  table tags
Web html table tags
 
css.ppt
css.pptcss.ppt
css.ppt
 
Html ppt
Html pptHtml ppt
Html ppt
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
File organization 1
File organization 1File organization 1
File organization 1
 
XML
XMLXML
XML
 
Presentation on Database management system
Presentation on Database management systemPresentation on Database management system
Presentation on Database management system
 
Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databases
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 

Ähnlich wie 01 xml document structure

Ch2 neworder
Ch2 neworderCh2 neworder
Ch2 neworder
davidlahr32
 
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
 
Xml
XmlXml
Xml
soumya
 
Intro to xml
Intro to xmlIntro to xml
Intro to xml
Tarun Jain
 

Ähnlich wie 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
 
Ch2 neworder
Ch2 neworderCh2 neworder
Ch2 neworder
 
1 xml fundamentals
1 xml fundamentals1 xml fundamentals
1 xml fundamentals
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 
XML-Unit 1.ppt
XML-Unit 1.pptXML-Unit 1.ppt
XML-Unit 1.ppt
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
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
 
Web Technology Part 4
Web Technology Part 4Web Technology Part 4
Web Technology Part 4
 
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
 
Xml 1
Xml 1Xml 1
Xml 1
 
XML DTD DOCUMENT TYPE DEFINITION
XML DTD DOCUMENT TYPE DEFINITIONXML DTD DOCUMENT TYPE DEFINITION
XML DTD DOCUMENT TYPE DEFINITION
 
Xml
XmlXml
Xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Web Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdfWeb Technologies Unit 2 Print.pdf
Web Technologies Unit 2 Print.pdf
 
Xml basics
Xml basicsXml basics
Xml basics
 
Intro to xml
Intro to xmlIntro to xml
Intro to xml
 
Xml dtd
Xml dtdXml dtd
Xml dtd
 
WT UNIT-2 XML.pdf
WT UNIT-2 XML.pdfWT UNIT-2 XML.pdf
WT UNIT-2 XML.pdf
 
Intro xml
Intro xmlIntro xml
Intro xml
 

Mehr von Baskarkncet (20)

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 xml schema
02 xml schema02 xml schema
02 xml schema
 
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
 

KĂźrzlich hochgeladen

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
sivaprakash250
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
SUHANI PANDEY
 

KĂźrzlich hochgeladen (20)

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 

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
  • 21.
  • 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