Some common XML interview questions and answers
What is XML?
XML stands for Extensible Markup Language .It is a markup language used for formatting data for storage and transportation.Markup languages are used for formatting data in different formats.Unlike HTML ,which is also a markup language ,XML doesn’t have predefined tags.User can create tags as required.
XML is called Extensible Markup Language because user can add new tags as required.XML documents are text files which can be edited with any text editor.
Difference between HTML and XML?
- XML is used for formatting data for storing and transportation.HTML is used for formatting data for displaying in a web page.
- Unlike HTML in XML there are no predefined tags.
- XML is case sensitive unlike HTML.
Where XML version is specified in XML document?
XML version should be specified as the first line in the XML document.
Advantage of XML?
XML is language and platform independent.So it can be used in any language and platform.
What is XML DOM?
DOM stands for document object model.It allows programs to dynamically update the document.DOM consists of a tree of objects.It allows program to update the XML elements.
What are attributes and elements?
Element is a XML tag.We add new elements as required.Attributes give more information about the element.Here element is Employee and Id is the attribute since it gives additional information about the employee.
An element can contain the following:
- Another element
- Hierarchy of elements
Its mandatory to have a single root element.
What is XSL?
XSL stands for Extensible Stylesheet Language .It is used to specify how XML documents should be displayed.
Valid XML rules?
A well-formed XML document must follow the following rules –
- Every start tag should end with an end tag
- XML tags are case sensitive
- Empty tags are necessary to close with a forward slash
- All tags should be properly nested
- One and only one root element.
What is DTD?
DTD is called Document Type Definition and used to verify if XML document is valid.It can declared in the same XML document or externally using <!DOCTYPE> element.
What is XQuery?
It is query language for XML documents.As SQL is used for querying databases ,XQuery is used for querying XML documents.