SlideShare une entreprise Scribd logo
1  sur  19
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

Contenu connexe

Tendances

Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDFNarni Rajesh
 
HTML + CSS Examples
HTML + CSS ExamplesHTML + CSS Examples
HTML + CSS ExamplesMohamed Loey
 
Introduction to web technology
Introduction to web technologyIntroduction to web technology
Introduction to web technologyVARSHAKUMARI49
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Peter R. Egli
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web servicesNeil Ghosh
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsStefano Celentano
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service designRamin Orujov
 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsSun Technlogies
 
Active server pages
Active server pagesActive server pages
Active server pagesmcatahir947
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding RESTNitin Pande
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete NotesEPAM Systems
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginnersSingsys Pte Ltd
 
Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In PhpHarit Kothari
 

Tendances (20)

Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
HTML + CSS Examples
HTML + CSS ExamplesHTML + CSS Examples
HTML + CSS Examples
 
Introduction to web technology
Introduction to web technologyIntroduction to web technology
Introduction to web technology
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web services
 
Xpath
XpathXpath
Xpath
 
Introduction to Sightly and Sling Models
Introduction to Sightly and Sling ModelsIntroduction to Sightly and Sling Models
Introduction to Sightly and Sling Models
 
Json
JsonJson
Json
 
Best practices for RESTful web service design
Best practices for RESTful web service designBest practices for RESTful web service design
Best practices for RESTful web service design
 
HTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts BasicsHTML, CSS and Java Scripts Basics
HTML, CSS and Java Scripts Basics
 
Html 5
Html 5Html 5
Html 5
 
Active server pages
Active server pagesActive server pages
Active server pages
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
 
Json Web Token - JWT
Json Web Token - JWTJson Web Token - JWT
Json Web Token - JWT
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
 
XSLT
XSLTXSLT
XSLT
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
Form Processing In Php
Form Processing In PhpForm Processing In Php
Form Processing In Php
 

Similaire à 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
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
 

Dernier

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
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...Call Girls in Nagpur High Profile
 
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 Bookingdharasingh5698
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
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...Call Girls in Nagpur High Profile
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 

Dernier (20)

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
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...
 
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
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
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...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 

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