Logo F2FInterview

XML Interview Questions

Q   |   QA

A simple element is an XML element that can contain only text.

  • Namespaces are a simple and straightforward way to distinguish names used in XML documents, no matter where they come from.
  • XML namespaces are used for providing uniquely named elements and attributes in an XML instance
  • They allow developers to qualify uniquely the element names and relationships and make these names recognizable, to avoid name collisions on elements that have the     same name but are defined in different vocabularies.
  • They allow tags from multiple namespaces to be mixed, which is essential if data is coming from multiple sources.

Example: a bookstore may define the <TITLE> tag to mean the title of a book, contained only within the <BOOK> element. A directory of people, however, might define <TITLE> to indicate a person's position, for instance: <TITLE>President</TITLE>. Namespaces help define this distinction clearly.

Note: a) Every namespace has a unique name which is a string. To maintain the uniqueness among namespaces a IRL is most preferred approach, since URLs are unique.

         b) Except for no-namespace Schemas, every XML Schema uses at least two namespaces:
                1.the target namespace.
                2. The XMLSchema namespace (http://w3.org/2001/XMLSchema)  

There are two ways to use namespaces:

  • Declare a default namespace
  • Associate a prefix with a namespace, then use the prefix in the XML to refer to the namespace

ElementFormDefault indicates whether or not locally declared elements must be qualified by the target namespace in an instance document. ElementFormDefault attribute in the Schema has the following relevance:

  • Qualified: Each and every element of the Schema must be qualified with the namespace in the instance document.
  • Unqualified: means only globally declared elements must be qualified with there namespace and not the local elements.
     

An XML parser is a piece of software which can do following:

  • Check for well-formedness
  • Validate the document
  • Allows us to read, create or modify existing XML documents

Note: Parser is piece of software provided by vendors. An XML parser is built in Java runtime from JDK 1.4 onwards

SAX-Simple API for XML processing. SAX provides a mechanism for reading data from an XML document. It is a popular alternative to the Document Object Model (DOM).SAX provides an event based processing approach unlike DOM which is tree based.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: