Java
XML Tutorial
XML referred
to be as Extensible Markup Language. It’s a widely use mode of communication
between two applications. Java provides a large set of libraries to parse, modify,
create or query XML files.
XML is
basically a text based language which is designed for communication between two
applications, it stores and transport data in plain text form.
- XML is W3C recommendation for data storage and
transport
- XML is a markup language
- XML is tag based language like HTML
- XML tags are not pre -defined , we can define our
tags in XML unlike HTML
Pros and Cons of using XML
Pros:
- It is easy to adapt and being plain text , XML
can be used by any technology for data storage and transmission , hence it
is technology independent.
- It is easy to read and understand.
- We can create our own custom tags
- Using XSD
, DTD and XML structure can be validated easily
Cons:
- XML file increases the transmission and storage
costs
- It contains lot of repetitive terms
XML PARSERS
In order to
access or modify data in XML , we need to traverse through the XML document.
XML Parsers
provides way to access or modify data present in the XML document.
Please find
the list if various types of parsers which are commonly use to parse XML
documents
- DOM Parser : It parse the document by loading
the complete contents of the xml document along with its hierarchical tree
in memory
- SAX Parser : It parses the document on event
based triggers and it doesn’t load complete document into the memory
- JDOM Parser: It will be like DOM parser but it parses
in more efficient way
- Stax Parser : It will be like SAX parser but parses in
more efficient way
- XPath Parser : It will parses the XML based on
expression
- DOM4J Parser : A Java defined library which is used to
parse XML,XPATH using collection framework.
We will
discuss each parsers in details in our next articles
No comments:
Post a Comment