SlideShare a Scribd company logo
Seminar On:
XML & XML
Processor
Submitted By: Himanshu Soni
Branch: CS
Roll No: 1301410040
Subject: Web Technolgy
(NCS-504)
 Introduction to XML
 HTML Vs XML
 Structure of XML Document
 XML Processor
 Parser
 DOM & SAX
 References
Introduction to XML
What is XML ?
 XML is an acronym for “eXtensible Markup
Language”.
 XML is a markup language derived from
SGML (Standard Generalised Markup
language).
 It is used to store data in structured format.
HTML vs XML
HTML XML
HTML document formats and
displays web page data.
XML document carry data along
with their description.
Predefined tags (Predefined
markup language).
Not have predefined tags.You
can create and define new tags
as per your needs.(Meta
Language).
May not have closing tag. Must have closing tag.
Not Case Sensitive. Case Sensitive.
Directly Viewable in browser. Viewable if proper Stylesheet
provided.
HTML
Browser
StylesheetXML
Structure of XML Document System
 A style sheet presentation through CSS or XSL.
 A grammer structure through DTD.
 A semantics of data through XML file.
Semantics and
data,
XML file
Grammer
Structure,
DTD
Syle-sheet,
CSS or XSL
Structure of XML file
XML file has –
-a logical structure and
- a physical structure
Logical Structure:
It refers to different parts of
document i.e., how document is built.
Physical Structure:
It refers what document actually
contains.
Logical Structure
-prolog (preface or introduction to XML document)
-data instance (the real or actual data)
Prolog Data Instance
 An XMl declaration
 Processing Instruction
 A document type definition
 Comments
 White Spaces
 Element types, tags and
names
 White Spaces
Prolog
XML declaration
<? xml version=“1.0” encoding= “UTF-8” standalone=“no” ?>
Processing Instruction
<? xml-stylesheet type=“text/css” href=“main.css” ?>
Document Type Declaration (DTD)
<! DOCTYPE rootElement SYSTEM DTD_File_Name.dtd>
Comments
<!– Listen Here -->
White Spaces
Spaces, tabs, linebreak
XML Processor
 When a software program reads an XML
document and takes actions accordingly, this
is called processing the XML.
 Any program that can read and process XML
documents is known as an XML processor.
 An XML processor reads the XML file and
turns it into in-memory structures that the
rest of the program can access.
What is Parser?
The word parser comes from compilers. In a
compiler, a parser is the module that reads and
interprets the programming language.
Parsers are software components that decode XML
files on behalf of the application
There are two basic ways to interface a parser with
an application:
-object-based interfaces
-event-based interfaces
Architecture of XML Program
Divided into two parts:
• The parser deals with the XML file.
• The application consumes the content of the file through the
parser.
Here application can be very simple (such as printing information on
the screen), or quite complex (such as a browser or an editor)
Object-based Interface
 Using an object-based interface, the parser explicitly builds
a tree of objects that contains all the elements in the XML
document.
 Tree-based parsers deal generally small documents
Example-
<?xml version=”1.0”?>
<products>
<product>
<name>XML Editor</name>
<price>499.00</price>
</product>
<product>
<name>DTD Editor</name>
<price>199.00</price>
</product>
<products>
Building the tree of objects
Event-based Interface
 With an event-based interface, the parser does not explicitly
build a tree of objects.
 Instead, it reads the file and generates events as it finds
elements, attributes, or text in the file.
 There are events for element starts, element ends,
attributes, text content, entities, and so on.
 Event-based parsers deal generally used for large
documents
An event-based API
DOM
 The Document Object Model (DOM) is an
application programming interface (API) for HTML
and XML documents.
 It defines the logical structure of documents and
the way a document is accessed and manipulated
 Programmers can build documents, navigate their
structure, and add, modify, or delete elements and
content i.e.
The API allows for constructing, accessing and
manipulating the structure and content of XML
documents
 Basically, DOM is object based parser
DOM
DOM Parser DOM TreeXML File
A
P
I
Application
SAX
 SAX (Simple API for XML) is an event-
driven algorithm for parsing XML documents.
 SAX provides a mechanism for reading data from
an XML document.
 SAX parsers operate on each piece of the XML
document sequentially.
 SAX parsing is unidirectional; previously parsed
data cannot be re-read without starting the
parsing operation again
SAX vs DOM Parsing: Efficiency
The DOM object built by DOM parsers is usually
complicated and requires more memory storage than
the XML file itself
A lot of time is spent on construction before use
For some very large documents, this may be
impractical
SAX parsers store only local information that is
encountered during the serial traversal.
Hence, programming with SAX parsers is, in
general, more efficient but difficult to implement
sonetime.
References
 Benoit Marchal. XML by Example. 1 edition. QUE
(14 December 1999)
 Pankaj Sharma. Introduction to Web Technology.
S.K. Kataria & Sons
 Sumita Arora. Informatics Practices. Dhanpat Rai &
Co. (P) Ltd., Delhi 2010
 https://en.wikipedia.org/wiki/XML

More Related Content

What's hot

JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
Jeff Fox
 
Jsp element
Jsp elementJsp element
Jsp element
kamal kotecha
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
presentation in html,css,javascript
presentation in html,css,javascriptpresentation in html,css,javascript
presentation in html,css,javascript
FaysalAhammed5
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
Walid Ashraf
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
Baskarkncet
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Ravinder Kamboj
 
XSLT
XSLTXSLT
Xml
XmlXml
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
Mary Brinda
 
Json
JsonJson
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Gil Fink
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
EPAM Systems
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
pratik tambekar
 
Json
JsonJson
What Is Php
What Is PhpWhat Is Php
What Is Php
AVC
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
Umar Ali
 

What's hot (20)

Js ppt
Js pptJs ppt
Js ppt
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
 
Jsp element
Jsp elementJsp element
Jsp element
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
presentation in html,css,javascript
presentation in html,css,javascriptpresentation in html,css,javascript
presentation in html,css,javascript
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
XSLT
XSLTXSLT
XSLT
 
Xml
XmlXml
Xml
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
 
Json
JsonJson
Json
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Json
JsonJson
Json
 
XML
XMLXML
XML
 
What Is Php
What Is PhpWhat Is Php
What Is Php
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
 
JSP
JSPJSP
JSP
 

Similar to Xml and xml processor

Python xml processing
Python   xml processingPython   xml processing
Python xml processing
Learnbay Datascience
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
Abhishek Kesharwani
 
Applied xml programming for microsoft
Applied xml programming for microsoftApplied xml programming for microsoft
Applied xml programming for microsoftRaghu nath
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xmlsoumya
 
Xml parsing
Xml parsingXml parsing
Xml parsing
Malintha Adikari
 
Xml
XmlXml
XML Tutor maXbox starter27
XML Tutor maXbox starter27XML Tutor maXbox starter27
XML Tutor maXbox starter27
Max Kleiner
 
UNIT-1 Web services
UNIT-1 Web servicesUNIT-1 Web services
UNIT-1 Web services
madhusrinivasan9
 
Oracle soa xml faq
Oracle soa xml faqOracle soa xml faq
Oracle soa xml faq
xavier john
 
Full xml
Full xmlFull xml
Xml programming language myassignmenthelp.net
Xml programming  language myassignmenthelp.netXml programming  language myassignmenthelp.net
Xml programming language myassignmenthelp.net
www.myassignmenthelp.net
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
University of Connecticut Libraries
 
Module 5 XML Notes.pdf
Module 5 XML Notes.pdfModule 5 XML Notes.pdf
Module 5 XML Notes.pdf
ssuser21721b
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
AmarYa2
 

Similar to Xml and xml processor (20)

Python xml processing
Python   xml processingPython   xml processing
Python xml processing
 
Unit 2.3
Unit 2.3Unit 2.3
Unit 2.3
 
Unit 2.3
Unit 2.3Unit 2.3
Unit 2.3
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
Applied xml programming for microsoft
Applied xml programming for microsoftApplied xml programming for microsoft
Applied xml programming for microsoft
 
Introduction to xml
Introduction to xmlIntroduction to xml
Introduction to xml
 
Xml parsing
Xml parsingXml parsing
Xml parsing
 
Xml
XmlXml
Xml
 
XML Tutor maXbox starter27
XML Tutor maXbox starter27XML Tutor maXbox starter27
XML Tutor maXbox starter27
 
UNIT-1 Web services
UNIT-1 Web servicesUNIT-1 Web services
UNIT-1 Web services
 
Oracle soa xml faq
Oracle soa xml faqOracle soa xml faq
Oracle soa xml faq
 
Full xml
Full xmlFull xml
Full xml
 
XMl
XMlXMl
XMl
 
Xml programming language myassignmenthelp.net
Xml programming  language myassignmenthelp.netXml programming  language myassignmenthelp.net
Xml programming language myassignmenthelp.net
 
Xml
XmlXml
Xml
 
Xml3
Xml3Xml3
Xml3
 
Xml3
Xml3Xml3
Xml3
 
CTDA Workshop on XML and MODS
CTDA Workshop on XML and MODSCTDA Workshop on XML and MODS
CTDA Workshop on XML and MODS
 
Module 5 XML Notes.pdf
Module 5 XML Notes.pdfModule 5 XML Notes.pdf
Module 5 XML Notes.pdf
 
XML notes.pptx
XML notes.pptxXML notes.pptx
XML notes.pptx
 

Recently uploaded

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 

Recently uploaded (20)

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 

Xml and xml processor

  • 1. Seminar On: XML & XML Processor Submitted By: Himanshu Soni Branch: CS Roll No: 1301410040 Subject: Web Technolgy (NCS-504)  Introduction to XML  HTML Vs XML  Structure of XML Document  XML Processor  Parser  DOM & SAX  References
  • 2. Introduction to XML What is XML ?  XML is an acronym for “eXtensible Markup Language”.  XML is a markup language derived from SGML (Standard Generalised Markup language).  It is used to store data in structured format.
  • 3. HTML vs XML HTML XML HTML document formats and displays web page data. XML document carry data along with their description. Predefined tags (Predefined markup language). Not have predefined tags.You can create and define new tags as per your needs.(Meta Language). May not have closing tag. Must have closing tag. Not Case Sensitive. Case Sensitive. Directly Viewable in browser. Viewable if proper Stylesheet provided.
  • 5. Structure of XML Document System  A style sheet presentation through CSS or XSL.  A grammer structure through DTD.  A semantics of data through XML file. Semantics and data, XML file Grammer Structure, DTD Syle-sheet, CSS or XSL
  • 6. Structure of XML file XML file has – -a logical structure and - a physical structure Logical Structure: It refers to different parts of document i.e., how document is built. Physical Structure: It refers what document actually contains.
  • 7. Logical Structure -prolog (preface or introduction to XML document) -data instance (the real or actual data) Prolog Data Instance  An XMl declaration  Processing Instruction  A document type definition  Comments  White Spaces  Element types, tags and names  White Spaces
  • 8. Prolog XML declaration <? xml version=“1.0” encoding= “UTF-8” standalone=“no” ?> Processing Instruction <? xml-stylesheet type=“text/css” href=“main.css” ?> Document Type Declaration (DTD) <! DOCTYPE rootElement SYSTEM DTD_File_Name.dtd> Comments <!– Listen Here --> White Spaces Spaces, tabs, linebreak
  • 9. XML Processor  When a software program reads an XML document and takes actions accordingly, this is called processing the XML.  Any program that can read and process XML documents is known as an XML processor.  An XML processor reads the XML file and turns it into in-memory structures that the rest of the program can access.
  • 10. What is Parser? The word parser comes from compilers. In a compiler, a parser is the module that reads and interprets the programming language. Parsers are software components that decode XML files on behalf of the application There are two basic ways to interface a parser with an application: -object-based interfaces -event-based interfaces
  • 11. Architecture of XML Program Divided into two parts: • The parser deals with the XML file. • The application consumes the content of the file through the parser. Here application can be very simple (such as printing information on the screen), or quite complex (such as a browser or an editor)
  • 12. Object-based Interface  Using an object-based interface, the parser explicitly builds a tree of objects that contains all the elements in the XML document.  Tree-based parsers deal generally small documents Example- <?xml version=”1.0”?> <products> <product> <name>XML Editor</name> <price>499.00</price> </product> <product> <name>DTD Editor</name> <price>199.00</price> </product> <products>
  • 13. Building the tree of objects
  • 14. Event-based Interface  With an event-based interface, the parser does not explicitly build a tree of objects.  Instead, it reads the file and generates events as it finds elements, attributes, or text in the file.  There are events for element starts, element ends, attributes, text content, entities, and so on.  Event-based parsers deal generally used for large documents An event-based API
  • 15. DOM  The Document Object Model (DOM) is an application programming interface (API) for HTML and XML documents.  It defines the logical structure of documents and the way a document is accessed and manipulated  Programmers can build documents, navigate their structure, and add, modify, or delete elements and content i.e. The API allows for constructing, accessing and manipulating the structure and content of XML documents  Basically, DOM is object based parser
  • 16. DOM DOM Parser DOM TreeXML File A P I Application
  • 17. SAX  SAX (Simple API for XML) is an event- driven algorithm for parsing XML documents.  SAX provides a mechanism for reading data from an XML document.  SAX parsers operate on each piece of the XML document sequentially.  SAX parsing is unidirectional; previously parsed data cannot be re-read without starting the parsing operation again
  • 18. SAX vs DOM Parsing: Efficiency The DOM object built by DOM parsers is usually complicated and requires more memory storage than the XML file itself A lot of time is spent on construction before use For some very large documents, this may be impractical SAX parsers store only local information that is encountered during the serial traversal. Hence, programming with SAX parsers is, in general, more efficient but difficult to implement sonetime.
  • 19. References  Benoit Marchal. XML by Example. 1 edition. QUE (14 December 1999)  Pankaj Sharma. Introduction to Web Technology. S.K. Kataria & Sons  Sumita Arora. Informatics Practices. Dhanpat Rai & Co. (P) Ltd., Delhi 2010  https://en.wikipedia.org/wiki/XML