InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Can we create an XML document using DOM4J parser? |
|
Answer» Yes! Using DOM4J parser, we can parse, modify and create a XML document. |
|
| 2. |
Name some of the important DOM4J methods. |
|
Answer» When you are working with the DOM4J, there are several methods you'll use often −
|
|
| 3. |
Name some of the important DOM4J classes. |
|
Answer» The DOM4J defines several Java classes. Here are the most common classes −
|
|
| 4. |
When are the advantages of using a DOM4J Parser? |
|
Answer» DOM4J gives java developers flexibility and easy maintainablity of xml parsing code. It is light weight and quick API. |
|
| 5. |
When are the benefits of using a DOM4J Parser? |
|
Answer» When you parse an XML document with a DOM4J parser, you get the flexibility to get back a tree structure that contains all of the elements of your document without impacting the memory footprint of the application. The DOM4J provides a variety of utility functions you can use to examine the contents and structure of the document in case document is well structured and its structure is known. DOM4J uses XPath expression to navigate through the XML document. |
|
| 6. |
When to use a DOM4J Parser? |
|
Answer» You should use a DOM4J parser when −
|
|
| 7. |
What is DOM4J Parser? |
|
Answer» DOM4J is an open source, java based library to parse XML document and it is highly flexible, high-performance, and memory-efficient API. It is java optimized, it uses java collection like List and Arrays. It works with DOM, SAX, XPath and XSLT. It can parse large XML document with very low memory footprint. |
|
| 8. |
Can we create an XML document using XPath parser? |
|
Answer» No! XPath parser is used to to navigate XML Document only. It is better to use DOM parser for creating XML. |
|
| 9. |
What is path expression in XPath? |
||||||||||||||||||||
|
Answer» XPath uses a path expression to select node or list of nodes from an xml document. Following is the list of useful paths and expression to select any node/ list of nodes from an xml document.
|
|||||||||||||||||||||
| 10. |
What is predicate in XPath? |
||||||||||
|
Answer» Predicate are used to find specific node or a node containing specific value and are defined using [...] .
|
|||||||||||
| 11. |
What are the key components of XPath? |
|
Answer» Following are the key components of XPath −
|
|
| 12. |
What is XPath? |
|
Answer» The XPath is an official recommendation of the World Wide Web Consortium (W3C). It defines a language to find information in an XML file. It is used to traverse elements and attributes of an XML document. XPath provides various type of expressions which can be used to enquire relevant information from the XML document. |
|
| 13. |
Explain XMLStreamWriter Class of StAX parser. |
|
Answer» This interface specifies methods for creating an event.
|
|
| 14. |
Explain XMLStreamReader Class of StAX parser. |
|
Answer» This class provide iterator of events which can be used to iterate over events as they occur while parsing the XML document
|
|
| 15. |
Explain XMLEventWriter Class of StAX parser. |
|
Answer» This interface specifies methods for creating an event.
|
|
| 16. |
Explain XMLEventReader Class of StAX parser. |
|
Answer» This class provide iterator of events which can be used to iterate over events as they occur while parsing the XML document.
|
|
| 17. |
What are the disadvantages of StAX parser? |
Answer»
|
|
| 18. |
When you should use a StAX parser? |
|
Answer» You should use a StAX parser when −
|
|
| 19. |
Is StAX parser a PULL API? |
|
Answer» Yes! StAX is a PULL API. |
|
| 20. |
Can we create an XML document using StAX parser? |
|
Answer» Yes! Using StAX parser, we can parse, modify and create a XML document. |
|
| 21. |
What is a StAX Parser? |
|
Answer» StAX is a JAVA based API to parse XML document in a similar way as SAX parser does but StAX is a PULL API where as SAX is a PUSH API. It means in case of StAX parser, client application need to ask StAX parser to get information from XML whenever it needs but in case of SAX parser, client application is required to get information when SAX parser notifies the client application that information is available. |
|
| 22. |
Can we create an XML document using JDOM parser? |
|
Answer» Yes! Using JDOM parser, we can parse, modify and create a XML document. |
|
| 23. |
Name some of the important JDOM methods. |
|
Answer» When you are working with the JDOM, there are several methods you'll use often −
|
|
| 24. |
Name some of the important JDOM classes. |
|
Answer» The JDOM defines several Java classes. Here are the most common classes −
|
|
| 25. |
What are the advantages of JDOM parser? |
|
Answer» When you parse an XML document with a JDOM parser, you get the flexibility to get back a tree structure that contains all of the elements of your document without impacting the memory footprint of the application. The JDOM provides a variety of utility functions you can use to examine the contents and structure of the document in case document is well structured and its structure is known. JDOM gives java developers flexibility and easy maintainablity of xml parsing code. It is light weight and quick API. |
|
| 26. |
When to use a JDOM Parser? |
|
Answer» You should use a JDOM parser when −
|
|
| 27. |
What are the benefits of JDOM parser? |
|
Answer» It is java optimized, it uses java collection like List and Arrays. It works with DOM and SAX APIs and combines the best of the two. It is of low memory footprint and is nearly as fast as SAX. |
|
| 28. |
What is JDOM Parser? |
|
Answer» JDOM is an open source, java based library to parse XML document and it is typically java developer friendly API. |
|
| 29. |
Can we create an XML document using SAX parser? |
|
Answer» No! Using SAX parser, we can only parse or modify a XML document. |
|
| 30. |
Name some methods for processing the attributes connected to an element in SAX parsing. |
|
Answer» Attributes Interface specifies methods for processing the attributes connected to an element.
|
|
| 31. |
Name some of the important SAX parsing methods. |
|
Answer» ContentHandler Interface specifies the callback methods that the SAX parser uses to notify an application program of the components of the XML document that it has seen.
|
|
| 32. |
What are the disadvantages of SAX Parsing? |
Answer»
|
|
| 33. |
When to use a SAX Parser? |
|
Answer» You should use a SAX parser when −
|
|
| 34. |
How a SAX Parser works? |
|
Answer» SAX (the Simple API for XML) is an event-based parser for xml documents.Unlike a DOM parser, a SAX parser creates no parse tree. SAX is a streaming interface for XML, which means that applications using SAX receive event notifications about the XML document being processed an element, and attribute, at a time in sequential order starting at the top of the document, and ending with the closing of the ROOT element. |
|
| 35. |
What is a SAX Parser? |
|
Answer» SAX Parser is an event-based parser for xml documents. |
|
| 36. |
What SAX stands for? |
|
Answer» SAX stands for Simple API for XML. |
|
| 37. |
Can we create an XML document using DOM parser? |
|
Answer» Yes! Using DOM parser, we can parse, modify or create a XML document. |
|
| 38. |
Name some of the important DOM parsing methods. |
|
Answer» When you are working with the DOM, there are several methods you'll use often −
|
|
| 39. |
What are the key components/interfaces of DOM Parsing? |
|
Answer» The DOM defines several Java interfaces. Here are the most common interfaces −
|
|
| 40. |
What are the advantages of DOM Parsing? |
|
Answer» The DOM is a common interface for manipulating document structures. One of its design goals is that Java code written for one DOM-compliant parser should run on any other DOM-compliant parser without changes. |
|
| 41. |
What DOM Parser returns? |
|
Answer» 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. |
|
| 42. |
When to use a DOM Parser? |
|
Answer» You should use a DOM parser when −
|
|
| 43. |
What is DOM? |
|
Answer» 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. |
|
| 44. |
What DOM stands for? |
|
Answer» DOM stands for Document Object Model. |
|
| 45. |
Name some of the parsers which are commonly used to parse XML documents. |
|
Answer» Following are various types of parsers which are commonly used to parse XML documents −
|
|
| 46. |
What is XML Parser? |
|
Answer» XML Parser provides way how to access or modify data present in an XML document. Java provides multiple options to parse XML document. |
|
| 47. |
What is XML Parsing? |
|
Answer» Parsing XML refers to going through XML document to access data or to modify data in one or other way. |
|
| 48. |
What are the disadvantages of using XML? |
|
Answer» Following are the disadvantages of XML usage −
|
|
| 49. |
What are the advantages of using XML? |
|
Answer» Following are the advantages that XML provides −
|
|
| 50. |
What XML stands for? |
|
Answer» XML stands for Extensible Markup Language. |
|