Friday, 2 September 2016

Java XML

                 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.
  1. XML is W3C recommendation for data storage and transport
  2. XML is a markup language
  3. XML is tag based language like HTML
  4. XML tags are not pre -defined , we can define our tags in XML unlike HTML
Pros and Cons of using XML
Pros:  
  1. 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.
  2. It is easy to read and understand.
  3. We can create our own custom tags
  4. Using  XSD , DTD and XML structure can be validated easily
Cons:
  1. XML file increases the transmission and storage costs
  2. 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
  1. DOM Parser : It parse the document by loading the complete contents of the xml document along with its hierarchical tree in memory
  2. SAX Parser : It parses the document on event based triggers and it doesn’t load complete document into the memory
  3. JDOM Parser:  It will be like DOM parser but it parses in more efficient way
  4. Stax Parser :  It will be like SAX parser but parses in more efficient way
  5. XPath Parser :  It will parses the XML based on expression
  6. 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