0% found this document useful (0 votes)
22 views

AOOD Week 12

This document discusses XML processing and parsing using Java APIs. It covers the Java API for XML Processing (JAXP), which supports parsing XML data using SAX and DOM standards. DOM parsing builds an in-memory object representation of the XML document as a tree structure. The DOM parser validates the XML document and checks that it is well-formatted. It then parses the document and creates a DOM document object containing all the information from the XML file. This DOM document can then be accessed and manipulated through the DOM API.

Uploaded by

NA CH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

AOOD Week 12

This document discusses XML processing and parsing using Java APIs. It covers the Java API for XML Processing (JAXP), which supports parsing XML data using SAX and DOM standards. DOM parsing builds an in-memory object representation of the XML document as a tree structure. The DOM parser validates the XML document and checks that it is well-formatted. It then parses the document and creates a DOM document object containing all the information from the XML file. This DOM document can then be accessed and manipulated through the DOM API.

Uploaded by

NA CH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Advance

OOP

Instructor: Saif Ali


Agenda
• XML Processing
• Java API for XML Processing (JAXP)
• Document Object Model
• DOM Parser
XML Processing:
XML parsing is the process of reading an XML
document and providing an interface to the user
application for accessing the document. XML
parser validates the document and check that the
document is well formatted.
Let's understand the working of XML parser by
the figure given below:
Java API for XML Processing (JAXP):
The Java API for XML Processing (JAXP) is for
processing XML data using applications written in
the Java programming language.
JAXP leverages the parser standards Simple API for
XML Parsing (SAX) and Document Object Model
(DOM) so that you can choose to parse your data as
a stream of events or to build an object
representation of it.
JAXP also supports the Extensible Stylesheet
Language Transformations (XSLT) standard, giving
control over the presentation of the data and
enabling to convert the data to other XML
documents or to other formats, such as HTML.
Document Object Model:
A DOM document is an object which contains all
the information of an XML document.
It makes sense of a connection point that
empowers projects to get to and alter the style,
design, and items in XML reports. XML parsers that
help DOM carry out this point of interaction.
DOM Parser:
DOM addresses the Document Object model. The
point when an article contains some data about
XML reports is called DOM Parser.
This seems to be a tree structure. DOM API is
carried out by a DOM Parser, which is extremely
simple and easy to utilize. It addresses an XML
Document into a tree design in which every
component addresses tree limbs, makes an In
Memory tree portrayal of the XML record, and then
parses it. More memory is expected for this.
Highlights of DOM Parser:
• The interior design can be made by DOM Parser.
• As a result of these inner designs, the client can
get data about the first XML docs.

Benefits of DOM Parser:


• DOM API is not difficult to utilize, so we can both
compose and understand activities.
• At the point when a report is required, then it
favors a wide part that can be haphazardly
gotten to.
Drawbacks of DOM Parser:
• Its productivity of memory isn't excessively
great, and it takes more memory cause XML
docs are expected to stack in there.
• In contrast with the SAX parser, it is excessively
sluggish.
Where to Use DOM Parser:
• Use it when you know a ton about the
construction of a report.
• Use it assuming you really want to involve the
data in an XML report at least a couple of times.
• You want to move portions of an XML report
around
DOM Interface:
• Node: The DOM Node interface is an abstract-
based class whereupon numerous other DOM
API objects are based, in this manner letting
those item types be utilized in much the same
way and frequently reciprocally.
• Element: It addresses a program component like
a package, class, or method.
• Attr: it is utilized for addressing a property of a
component.
• Text: It is the genuine substance of an Element
or Attr.
• Document: The document addresses the whole
XML document.
Any Question?

You might also like