Is there a XPath Expression that returns the DocumentType (dtd/schema)
of an xml document ?
No, the DocumentType isn't part of the data model supported by XPath
Also, when trying to call namespace-uri(nodeset-expression) with a null
argument using Java API, is it right to
assume that I will always get the namespace-uri of the document node ?
No, if you supply an empty node-set as the argument, you will get the empty string back.
(Which is the same as you get from the root node, but not from the document element: I:m not sure which you mean by the "document node".
Following is the code snippet I'm using to evaluate XPath Expressions
builder = ((Controller)transformer).makeBuilder();
if (builder != null)
docInfo = builder.build(ss);
if (docInfo != null)
context = ((Controller)transformer).makeContext(docInfo);
NamePool namepool = ((Controller)transformer).getNamePool();
if (namepool != null)
sctx = new StandaloneContext(namepool);
if (xpathExpression != null)
Expression expr = Expression.make(xpathExpression, sctx);
Value val = expr.evaluate(context);