|
Technical Interview Questions
Javascript Interview Questions
Oracle Interview Questions
XHtml Interview Questions
Ajax
Interview Questions
CSS Interview Questions
VB
Interview Questions
.........More
Programming Source Codes
Java Source Codes
Html Source Codes
CSS Source Codes
C Source Codes
.........More
Soft Skills
Communication Skills
Leadership Skills
.........More
|
|
XML Interview Questions and Answers
If I start using XML namespaces, do I need to change
my existing DTDs?
Probably. If you want your XML documents to be both
valid and conform to the XML namespaces recommendation,
you need to declare any xmlns attributes and use the
same qualified names in the DTD as in the body of the
document.
If your DTD contains element type and attribute names
from a single XML namespace, the easiest thing to do is
to use your XML namespace as the default XML namespace.
To do this, declare the attribute xmlns (no prefix) for
each possible root element type. If you can guarantee
that the DTD is always read , set the default value in
each xmlns attribute declaration to the URI used as your
namespace name. Otherwise, declare your XML namespace as
the default XML namespace on the root element of each
instance document.
If your DTD contains element type and attribute names
from multiple XML namespaces, you need to choose a
single prefix for each XML namespace and use these
consistently in qualified names in both the DTD and the
body of each document. You also need to declare your
xmlns attributes in the DTD and declare your XML
namespaces. As in the single XML namespace case, the
easiest way to do this is add xmlns attributes to each
possible root element type and use default values if
possible.
How do I create documents that use XML namespaces?
The same as you create documents that don't use XML
namespaces. If you're currently using Notepad on Windows
or emacs on Linux, you can continue using Notepad or
emacs. If you're using an XML editor that is not
namespace-aware, you can also continue to use that, as
qualified names are legal names in XML documents and
xmlns attributes are legal attributes. And if you're
using an XML editor that is namespace-aware, it will
probably provide features such as automatically
declaring XML namespaces and keeping track of prefixes
and the default XML namespace for you.
How can I check that a document conforms to the XML
namespaces recommendation?
Unfortunately, I know of no software that only checks
for conformance to the XML namespaces recommendation. It
is possible that some namespace-aware validating parsers
(such as those from DataChannel (Microsoft), IBM,
Oracle, or Sun) check XML namespace conformance as part
of parsing and validating. Thus, you might be able to
run your document through such parsers as a way of
testing conformance.
Note that writing an application to check conformance to
the XML namespaces recommendation is not as easy as it
might seem. The problem is that most parsers do not make
DTD information available to the application, so it
might not be possible to check conformance in the DTD.
Also note that writing a SAX 1.0 application that checks
conformance in the body of the document (as opposed to
the DTD) should be an easy thing to do.
Can I use the same document with both namespace-aware
and namespace-unaware applications?
Yes.
This situation is quite common, such as when a
namespace-aware application is built on top of a
namespace-unaware parser. Another common situation is
when you create an XML document with a namespace-unaware
XML editor but process it with a namespace-aware
application.
Using the same document with both namespace-aware and
namespace-unaware applications is possible because XML
namespaces use XML syntax. That is, an XML document that
uses XML namespaces is still an XML document and is
recognized as such by namespace-unaware software.
The only thing you need to be careful about when using
the same document with both namespace-aware and
namespace-unaware applications is when the
namespace-unaware application requires the document to
be valid. In this case, you must be careful to construct
your document in a way that is both valid and conforms
to the XML namespaces recommendation. (It is possible to
construct documents that conform to the XML namespaces
recommendation but are not valid and vice versa.)
What software is needed to process XML namespaces?
From a document author's perspective, this is generally
not a relevant question. Most XML documents are written
in a specific XML language and processed by an
application that understands that language. If the
language uses an XML namespace, then the application
will already use that namespace -- there is no need for
any special XML namespace software.
How do I use XML namespaces with Internet Explorer 5.0
and/or the MSXML parser?
WARNING! The following applies only to earlier versions
of MSXML. It does not apply to MSXML 4, which is the
currently shipping version [July, 2002].
An early version of the MSXML parser, which was shipped
as part of Internet Explorer 5.0, required that every
XML namespace prefix used in an element type or
attribute declaration had to be "declared" in the
attribute declaration for that element type. This had to
be done with a fixed xmlns attribute declaration. For
example, the following was accepted by MSXML and both
xmlns:google attributes were required:
<!ELEMENT google:A (#PCDATA)>
<!ATTLIST google:A
xmlns:google CDATA #FIXED "http://www.google.org/">
<!ELEMENT google:B (#PCDATA)>
<!ATTLIST google:B
xmlns:google CDATA #FIXED "http://www.google.org/">
MSXML returned an error for the following because the
second google prefix was not "declared":
<!ELEMENT google:A (#PCDATA)>
<!ATTLIST google:A
xmlns:google CDATA #FIXED "http://www.google.org/">
<!ELEMENT google:B (#PCDATA)>
The reason for this restriction was so that MSXML could
use universal names to match element type and attribute
declarations to elements and attributes during
validation. Although this would have simplified many of
the problems of writing documents that are both valid
and conform to the XML namespaces recommendation some
users complained about it because it was not part of the
XML namespaces recommendation. In response to these
complaints, Microsoft removed this restriction in later
versions, which are now shipping. Ironically, the idea
was later independently derived as a way to resolve the
problems of validity and namespaces. However, it has not
been implemented by anyone.
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
|