Home Interview Questions and Answers Java XML Interview Questions and Answers For Freshers Part-1

java xml1.What XML stands for?
XML stands for Extensible Markup Language.

2.What are the advantages of using XML?
Following are the advantages that XML provides −

Technology agnostic – Being plain text, XML is technology independent. It can be used by any technology for data storage and transmission purpose.

Human readable- XML uses simple text format. It is human readable and understandable.

Extensible – in XML, custom tags can be created and used very easily.

Allow Validation – Using XSD, DTD and XML structure can be validated easily.

3.What are the disadvantages of using XML?
Following are the disadvantages of XML usage −

Redundant Syntax – Normally XML file contains lot of repeatitive terms.

Verbose- Being a verbose language, XML file size increases the transmission and storage costs.

4.What is XML Parsing?
Parsing XML refers to going through XML document to access data or to modify data in one or other way.

5.What is XML Parser?
XML Parser provides way how to access or modify data present in an XML document. Java provides multiple options to parse XML document.

6.Name some of the parsers which are commonly used to parse XML documents.?
Following are various types of parsers which are commonly used to parse XML documents −

Dom Parser – Parses the document by loading the complete contents of the document and creating its complete hiearchical tree in memory.

SAX Parser – Parses the document on event based triggers. Does not load the complete document into the memory.

JDOM Parser – Parses the document in similar fashion to DOM parser but in more easier way.

StAX Parser – Parses the document in similar fashion to SAX parser but in more efficient way.

XPath Parser – Parses the XML based on expression and is used extensively in conjuction with XSLT.

DOM4J Parser – A java library to parse XML, XPath and XSLT using Java Collections Framework , provides support for DOM, SAX and JAXP.

7.What DOM stands for?
DOM stands for Document Object Model.

8.What is DOM?
DOM stands for Document Object Model and it is an official recommendation of the World Wide Web Consortium (W3C). It defines an interface that enables programs to access and update the style, structure,and contents of XML documents. XML parsers that support the DOM implement that interface.

9.When to use a DOM Parser?
You should use a DOM parser when −

You need to know a lot about the structure of a document

You need to move parts of the document around (you might want to sort certain elements, for example)

You need to use the information in the document more than once

10.What DOM Parser returns?
When you parse an XML document with a DOM parser, you get back a tree structure that contains all of the elements of your document. The DOM provides a variety of functions you can use to examine the contents and structure of the document.

You may also like

Leave a Comment