XML Parsers
XML Parsers
An XML parser is a software library or package that provides interfaces for client
applications to work with an XML document. The XML Parser is designed to read the
XML and create a way for programs to use XML.
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:
1. SAX
Advantages
1) It supports both read and write operations and the API is very simple to use.
Disadvantages
1) It is memory inefficient. (consumes more memory because the whole XML
document needs to loaded into memory).
Clients does not know what methods to call, they just overrides the methods of the
API and place his own code inside method.
Advantages
1) It is simple and memory efficient.
Disadvantages
1) It is event-based so its API is less intuitive.
2) Clients never know the full information because the data is broken into pieces.
XML Validation
A well formed XML document can be validated against DTD or Schema.
69.7M
1.2K
Difference between JDK, JRE, and JVM
In simple words we can say that a DTD defines the document structure with a list of
legal elements and attributes.
Actually DTD and XML schema both are used to form a well formed XML document.
We should avoid errors in XML documents because they will stop the XML programs.
XML schema
It is defined as an XML language
It supports a large number of built in data types and definition of derived data types