|
XML Interview Questions and Answers
What is server-side XPointer?
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 />
What about non-XML resources?
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.
What XPointer schemes are supported in this release?
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.
How do I configure an XPointer processor?
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.
How do integrate XPointer into my application?
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.
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
|