Home  Interview Questions  Certifications  Aptitude Questions  Tutorials  Placement Papers  Search  Resume  Soft Skills  Video  Forum  Blog

Android app on Google Play

Technical Interview Questions
Javascript Interview Questions
Oracle Interview Questions
XHtml Interview Questions
Ajax Interview Questions
CSS Interview Questions
VB Interview Questions

Programming Source Codes
Java Source Codes
Html Source Codes
CSS Source Codes
C Source Codes

Soft Skills
Communication Skills
Leadership Skills




XML Interview Questions and Answers

How do I use XML namespaces with DOM level 2?
// Check the local name.
// getNodeName() is a DOM level 1 method.

if (elementNode.getNodeName().equals("SalesOrder"))
// Add new database record.

might become the following namespace-aware code:

// Check the XML namespace name (URI).
// getNamespaceURI() is a DOM level 2 method.

String SALES_NS = "";
if (elementNode.getNamespaceURI().equals(SALES_NS))

// Check the local name.
// getLocalName() is a DOM level 2 method.

if (elementNode.getLocalName().equals("SalesOrder"))
// Add new database record.

Note that, unlike SAX 2.0, DOM level 2 treats xmlns attributes as normal attributes.

Can an application process documents that use XML namespaces and documents that don't use XML namespaces?
This is a common situation for generic applications, such as editors, browsers, and parsers, that are not wired to understand a particular XML language. Such applications simply treat all element type and attribute names as qualified names. Those names that are not mapped to an XML namespace -- that is, unprefixed element type names in the absence of a default XML namespace and unprefixed attribute names -- are simply processed as one-part names, such as by using a null XML namespace name (URI).
Note that such applications must decide how to treat documents that do not conform to the XML namespaces recommendation. For example, what should the application do if an element type name contains a colon (thus implying the existence of a prefix), but there are no XML namespace declarations in the document? The application can choose to treat this as an error, or it can treat the document as one that does not use XML namespaces, ignore the "error", and continue processing.

Can an application be both namespace-aware and namespace-unaware?
However, there is generally no reason to do this. The reason is that most applications understand a particular XML language, such as one used to transfer sales orders between companies. If the element type and attribute names in the language belong to an XML namespace, the application must be namespace-aware; if not, the application must be namespace-unaware.
For a few applications, being both namespace-aware and namespace-unaware makes sense. For example, a parser might choose to redefine validity in terms of universal names and have both namespace-aware and namespace-unaware validation modes. However, such applications are uncommon.

What does a namespace-aware application do when it encounters an error?
The XML namespaces recommendation does not specify what a namespace-aware application does when it encounters a document that does not conform to the recommendation. Therefore, the behavior is application-dependent. For example, the application could stop processing, post an error to a log and continue processing, or ignore the error.

What is a qualified name?
A qualified name is a name of the following form. It consists of an optional prefix and colon, followed by the local part, which is sometimes known as a local name.

For example, both of the following are qualified names. The first name has a prefix of serv; the second name does not have a prefix. For both names, the local part (local name) is Address.

In most circumstances, qualified names are mapped to universal names.

What characters are allowed in a qualified name?
The prefix can contain any character that is allowed in the Name [5] production in XML 1.0 except a colon. The same is true of the local name. Thus, there can be at most one colon in a qualified name -- the colon used to separate the prefix from the local name.

Page Numbers :   1      2      3       4      5       6       7      8      9     10      11       12      13      14      15      16      17      18     19      20      21      22      23      24

Have a Question ? post your questions here. It will be answered as soon as possible.

Check HTML Interview Questions for more HTML Interview Questions with Answers

Check JDBC Interview Questions for more JDBC Interview Questions with Answers

Check Job Interview Questions for more Interview Questions with Answers