Set - 5

Question 1 :

What is an XML namespace prefix?

Answer :

An XML namespace prefix is a prefix used to specify that a local element type or attribute name is in a particular XML namespace. For example, in the following, the serv prefix specifies that the Address element type name is in the http://www.foo.com/ito/addresses namespace: 
<serv:Addresses xmlns:serv="http://www.foo.com/ito/addresses">


Question 2 :

What is server-side XPointer?

Answer :

The XPointer Framework provides an authoritative and extensible interpretation of the semantics of fragment identifiers for XML media types. However, HTTP does NOT transmit the fragment identifier as part of the HTTP request. Therefore XPointer is generally applied by the client, not by the server. 
For example, assuming that http://www.myorg.org/myTripleStore identifies a resource that is willing to negotiate for RDF/XML, then the following is typical of an HTTP request for an RDF/XML representation of that resource and the server's response.
Request:

GET /myTripleStore HTTP/1.1
Host: www.myorg.org
Accept: application/rdf+xml

Response:
HTTP/1.1 200 Ok
Content-Type: application/rdf+xml

<rdf:RDF /> 
This request asks for the entire triple store, serialized as RDF/XML. 
Server-side XPointer uses the HTTP "Range" header to transmit the XPointer expression to the server. For example, let's assume that the URI of the triple store is the same, but we want to select the subresources identified by the following RDQL query: 
SELECT (?x foaf:mbox ?mbox)
WHERE (?x foaf:name "John Smith") (?x foaf:mbox ?mbox)
USING foaf FOR<http://xmlns.com/foaf/0.1/>
)

In that case the HTTP request, including a copy of the RDQL query wrapped up as an XPointer expression, looks as follows. Note that we have added a range-unit whose value is xpointer to indicate that the value of the Range header should be interpreted by an XPointer processor. Also note the use of the XPointer xmlns() scheme to set bind the namespace URI for the rdql() XPointer scheme. This is necessary since this scheme has not been standardized by the W3C. 
GET /myTripleStore HTTP/1.1
Host: www.myorg.org
Accept: application/rdf+xml
Range: xpointer = xmlns(x:http://www.mindswap.org)x:rdql(
SELECT (?x foaf:mbox ?mbox) 
WHERE (?x foaf:name "John Smith") (?x foaf:mbox ?mbox)
USING foaf FOR <http://xmlns.com/foaf/0.1/>
)

The response looks as follows. The HTTP 206 (Partial Content) status code is used to indicate that the server recognized and processed the Range header and that the response entity includes only the identified logical range of the addressed resource.
HTTP/1.1 206 Partial Content
Content-Type: application/rdf+xml

<!-- Only the selected sub-graph is transmitted to the client. --> <rdf:RDF />


Question 3 :

How do I use XML namespaces with SAX 2.0?

Answer :

SAX 2.0 primarily supports XML namespaces through the following methods: * startElement and endElement in the ContentHandler interface return namespace names (URIs) and local names as well as qualified names. * getValue, getType, and getIndex in the Attributes interface can retrieve attribute information by namespace name (URI) and local name as well as by qualified name.


Question 4 :

Can an application process documents that use XML namespaces and documents that don't use XML namespaces?

Answer :

Yes.
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.


Question 5 :

Can an application be both namespace-aware and namespace-unaware?

Answer :

Yes.
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.


Question 6 :

What does a namespace-aware application do when it encounters an error?

Answer :

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.
PART III: NAMES, PREFIXES, AND URIs


Question 7 :

What is a qualified name?

Answer :

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.
prefix:local-part
--OR--
local-part

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.
serv:Address
Address

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


Question 8 :

What characters are allowed in a qualified name?

Answer :

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.


Question 9 :

How are universal names represented?

Answer :

There is no standard way to represent a universal name. However, three representations are common.
The first representation keeps the XML namespace name (URI) and the local name separate. For example, many DOM level 1 implementations have different methods for returning the XML namespace name (URI) and the local name of an element or attribute node.
The second representation concatenates the namespace name (URI) and the local name with caret (^). The result is a universally unique name, since carets are not allowed in URIs or local names. This is the method used by John Cowan's Namespace SAX Filter . For example, the universal name that has the URI http://www.google.org/to/servers and the local name Address would be represented as:
http://www.foo.com/ito/servers^Address
The third representation places the XML namespace name (URI) in braces and concatenates this with the local name. This notation is suggested only for documentation and I am aware of no code that uses it. For example, the above name would be represented as:
{http://www.foo.com/ito/servers}Address


Question 10 :

Are universal names universally unique?

Answer :

No, but it is reasonable to assume they are.
Universal element type and attribute names are not guaranteed to be universally unique -- that is, unique within the space of all XML documents -- because it is possible for two different people, each defining their own XML namespace, to use the same URI and the same element type or attribute name. However, this occurs only if:
* One or both people use a URI that is not under their control, such as somebody outside Netscape using the URI http://www.netscape.com/, or
* Both people have control over a URI and both use it.

The first case means somebody is cheating when assigning URIs (a process governed by trust) and the second case means that two people within an organization are not paying attention to each other's work. For widely published element type and attribute names, neither case is very likely. Thus, it is reasonable to assume that universal names are universally unique. (Since both cases are possible, applications that present security risks should be careful about assuming that universal names are universally unique.)
For information about the ability of universal names to uniquely identify element types and attributes (as opposed to the names themselves being unique).


Question 11 :

What characters are allowed in an XML namespace prefix?

Answer :

The prefix can contain any character that is allowed in the Name [5] production in XML 1.0 except a colon.


Question 12 :

Can I use the same prefix for more than one XML namespace?

Answer :

Yes.


Question 13 :

What happens if there is no prefix on an element type name?

Answer :

If a default XML namespace declaration is in scope, then the element type name is in the default XML namespace. Otherwise, the element type name is not in any XML namespace.


Question 14 :

What does the URI used as an XML namespace name point to?

Answer :

The URI used as an XML namespace name is simply an identifier. It is not guaranteed to point to anything and, in general, it is a bad idea to assume that it does. This point causes a lot of confusion, so we'll repeat it here:
URIs USED AS XML NAMESPACE NAMES ARE JUST IDENTIFIERS. THEY ARE NOT GUARANTEED TO POINT TO ANYTHING.
While this might be confusing when URLs are used as namespace names, it is obvious when other types of URIs are used as namespace names. For example, the following namespace declaration uses an ISBN URN:
xmlns:xbe="urn:ISBN:0-7897-2504-5"
and the following namespace declaration uses a UUID URN:
xmlns:foo="urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
Clearly, neither namespace name points to anything on the Web.
NOTE: Namespace URIs that are URLs may point to RDDL documents, although this does not appear to be widely implemented. For details, see the next question.
NOTE: An early version of the W3C's XML Schemas used namespace URIs to point to an XML Schema document containing the definitions of the element types and attributes named in the namespace. However, this proved very controversial and the idea has been withdrawn.


Question 15 :

What is an XML namespace name?

Answer :

An XML namespace name is a URI that uniquely identifies the namespace. URIs are used because they are widely understood and well documented. Because people may only allocate URIs under their control, it is easy to ensure that no two XML namespaces are identified by the same URI.


Question 16 :

Can I resolve the URI used as an XML namespace name?

Answer :

Yes.


Question 17 :

Can I use a relative URI as a namespace name?

Answer :

Yes. However, such usage is deprecated, so you should never do it.


Question 18 :

What is XPointer?

Answer :

XPointer is set of recommendations developed by the W3C. The core recommendations are the XPointer Framework which provides an extensible addressing behavior for fragment identifiers in XML media types.
XPointer gains its extensibility through the XPointer Framework, which identifies the syntax and processing architecture for XPointer expressions and through an extensible set of XPointer addressing schemes. These schemes, e.g., element() or xpointer(), are actually QNames. The xmlns() scheme makes it possible for an XPointer to declare namespace bindings and thereby use third-party schemes as readily as W3C defined XPointer schemes.


Question 19 :

How do I install the XPointer processor?

Answer :

Download the latest "cweb-xpointer" release from SourceForge. This project uses Apache Maven and Java 1.4+, so you will need to install those as well. Normally you will also want to download one of the XPointer Framework integrations, such as the xpointer+dom4j or the xpointer+jdom package. These "integration packages" provide support for a specific XML Document model.
The project dependencies are explicitly declared in the Maven POM. This means that Maven can automagically download the required releases of dependent JARs.
There are several release artifacts. The "uberjar" release provides an executable command line utility (see below) and bundles all dependancies (except for Java itself). If you want to integrate into an existing application, then you should use the cweb-xpointer JAR and also download copies of its dependencies. If you are using a Maven project, then this is all very, very easy.


Question 20 :

What about non-XML resources?

Answer :

You can use the XPointer Framework with non-XML resources. This is especially effective when your resource is backed by some kind of a DBMS, or when you want to query a data model, such as RDF, and not the XML syntax of a representation of that data model.
However, please note that the authoratitive interpretation of the fragment identifier is determined by the Internet Media Type. If you want to opt-in for XPointer, then you can always create publish your own Internet Media Type with IANA and specify that it supports the XPointer Framework for some kind of non-XML resource. In this case, you are going to need to declare your own XPointer schemes as well.


Question 21 :

What XPointer schemes are supported in this release?

Answer :

The XPointer integration distributions support shorthand pointers. In addition, they bundle support for at last the following XPointer schemes:
* xmlns()
* element()
* xpath() - This is not a W3C defined XPointer scheme since W3C has not published an XPointer sheme for XPath. The namespace URI for this scheme is http://www.cogweb.org/xml/namespace/xpointer . It provides for addressing XML subresources using a XPath 1.0 expressions.


Question 22 :

How do I configure an XPointer processor?

Answer :

There is no required configuration for the XPointer Framework. The uberjar command line utility provides some configuration options. Applications configure individual XPointer processors when they obtain an instance from an appropriate XPointerProcessor factory method.


Question 23 :

How do integrate XPointer into my application?

Answer :

There are several ways to do this. The easiest is to use the uberjar release, which can be directly executed on any Java enabled platform. This makes it trivial to test and develop XPointer support in your applications, including server-side XPointer. The uberjar release contains a Java class org.CognitiveWeb.xpointer.XPointerDriver that provides a simple but flexible command line utility that exposes an XPointer processor. The XPointer is provided as a command line argument and the XML resource is read from stdin. The results are written on stdout by default as a set of null-terminated XML fragments. See XPointerDriver in the XPointer JavaDoc for more information.
If you already have a Java application, then it is straight-forward to integrate XPointer support using: org.CognitiveWeb.xpointer.XPointerProcessor You can see an example integration by looking at the XPointerDriver in the source code release.


Question 24 :

How do I implement an application-specific XPointer scheme?

Answer :

Short answer: Implement org.CognitiveWeb.xpointer.ISchemeProcessor
The XPointer Framework is extensible. One of the very coolest things about this is that you can develop your own XPointer schemes that expose your application using the data model that makes the most sense for your application clients.
For example, let's say that you have a CRM application. The important logical addressing units probably deal with concepts such as customers, channels, and products. You can directly expose these data using a logical addressing scheme independent of the actual XML data model. Not only does this let people directly address the relevant concepts using a purpose-built addressing vocabulary, but this means that your addressing scheme can remain valid even if you change or version your XML data model. What a bonus!
The same approach is being used by the MindSwap laboratory at the University of Maryland to prototype a variety of XPointer schemes for addressing semantic web data.


Question 25 :

How do I support very large resources?

Answer :

You can only do this with server-side XPointer. Further, you need to use (or implement) XPointer schemes that do not depend on a parsed XML document model. Basically, you need to use an XPointer scheme that interfaces with an indexed persistence store (RDBMS, ODBMS, or XML DBMS) which exposes to your ISchemeProcessor the information that it needs to answer subresource addressing requests.
You will also have to provide shorthand pointer support for your DBMS-based resource. The default shorthand pointer processor assumes that it has access to a parsed XML document, so it can't be used when you have a very large XML resource.


Question 26 :

How do I contribute?

Answer :

The XPointer implementation is hosted as a SourceForge project. If you want to contribute send an email to one of the project administrators from the project home page.
The XPointer module uses numerous tests to validate correct behavior of the XPointer processor. One valuable way to contribute is by developing new tests that demonstrate broken behavior. Patches that fix the problems identified by those tests are also valuable, but it is by the tests themselves that we can insure that each release of the XPointer processor will continue to meet the requirements of the various XPointer specifications.


Question 27 :

What's XLink?

Answer :

This specification defines the XML Linking Language (XLink), which allows elements to be inserted into XML documents in order to create and describe links between resources. It uses XML syntax to create structures that can describe links similar to the simple unidirectional hyperlinks of today's HTML, as well as more sophisticated links.
Definition: An XLink link is an explicit relationship between resources or portions of resources.] [Definition: It is made explicit by an XLink linking element, which is an XLink-conforming XML element that asserts the existence of a link.] There are six XLink elements; only two of them are considered linking elements. The others provide various pieces of information that describe the characteristics of a link. (The term "link" as used in this specification refers only to an XLink link, though nothing prevents non-XLink constructs from serving as links.)


Question 28 :

What are the valid values for xlink:actuate and xlink:show?

Answer :

Don't blame me to put such a simple question here. I saw a famous exam simulator gave wrong answer on this one. Typing them out also help me to remember them. xlink:actuate onRequest, onLoad, other, none xlink:show replace new embed other none


Question 29 :

Which of the following is true about XLink and HTML hyperlinks?

Answer :

1. XLink can be attached with any element. Hyperlinks in HTML can be attached to only an ANCHOR element.
2. XLink can refer to a specific location in XML document by name or context with the help of XPointer. HTML ANCHOR does not have capability to point to specific location within an html document.
3. XLink / XML links can be multidirectional. HTML links are unidirectional.
4. HTML links are activated when user clicks on them. XLink has option of activating automatically when XML document is processed.
Only 2 is incorrect, since HTML ANCHOR does have capability to point to specific location within an html document.


Question 30 :

What three essential components of security does the XML Signatures provide?

Answer :

authentication, message integrity, and non-repudiation. In addition to signature information, an XML Signature can also contain information describing the key used to sign the content.


Question 31 :

XLink Processing and Conformance ?

Answer :

Processing Dependencies: XLink processing depends on [XML], [XML Names], [XML Base], and [IETF RFC 2396]
Markup Conformance:
An XML element conforms to XLink if:
it has a type attribute from the XLink namespace whose value is one of "simple", "extended", "locator", "arc", "resource", "title", or "none", and
it adheres to the conformance constraints imposed by the chosen XLink element type, as prescribed in this specification.
This specification imposes no particular constraints on DTDs; conformance applies only to elements and attributes.
Application Conformance:
An XLink application is any software module that interprets well-formed XML documents containing XLink elements and attributes, or XML information sets [XIS] containing information items and properties corresponding to XLink elements and attributes. (This document refers to elements and attributes, but all specifications herein apply to their information set equivalents as well.) Such an application is conforming if:

it observes the mandatory conditions for applications ("must") set forth in this specification, and
for any optional conditions ("should" and "may") it chooses to observe, it observes them in the way prescribed, and
it performs markup conformance testing according to all the conformance constraints appearing in this specification.


Question 32 :

XLink Markup Design

Answer :

Link markup needs to be recognized reliably by XLink applications in order to be traversed and handled properly. XLink uses the mechanism described in the Namespaces in XML Recommendation [XML Names] to accomplish recognition of the constructs in the XLink vocabulary.