[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: Re: A New approach for XPath using Namespace
From: David Waite <mass () akuma ! org>
Date: 2004-06-23 17:14:07
Message-ID: BC8FB064-C538-11D8-B8AD-000A95C89D86 () akuma ! org
[Download RAW message or body]
On Jun 23, 2004, at 10:58 AM, nn wrote:
> Sorry forgetting to add prefix in the XPath (that is actually what I
> don't
> like. It is too redundent. I want to use simple XPath without prefix
> assuming default namespace is the targetNamespace of the xsd file of
> the
> target document).
Yes, but XPath 1.0 specifically says that this isn't the case:
http://www.w3.org/TR/xpath#node-tests
A QName in the node test is expanded into an expanded-name using the
namespace declarations from the expression context. This is the same
way expansion is done for element type names in start and end-tags
except that the default namespace declared with xmlns is not used: if
the QName does not have a prefix, then the namespace URI is null (this
is the same way attribute names are expanded). It is an error if the
QName has a prefix for which there is no namespace declaration in the
expression context.
this changes in XPath 2.0 (http://www.w3.org/TR/xpath20/#node-tests);
you can define what the deafult element/type namespace is as another
element of the expression context:
A QName in a name test is expanded into an expanded-QName using the
in-scope namespaces in the expression context. It is a static error
[err:XP0008] if the QName has a prefix that does not correspond to any
in-scope namespace. An unprefixed QName, when used as a name test on an
axis whose principal node kind is element, has the namespace URI of the
default element/type namespace in the expression context; otherwise, it
has no namespace URI.
Of course, XPath 2.0 isn't finished yet :)
-David Waite
On Jun 23, 2004, at 10:58 AM, nn wrote:
<excerpt>Sorry forgetting to add prefix in the XPath (that is actually
what I don't
like. It is too redundent. I want to use simple XPath without prefix
assuming default namespace is the targetNamespace of the xsd file of
the
target document).
</excerpt>Yes, but XPath 1.0 specifically says that this isn't the
case:
http://www.w3.org/TR/xpath#node-tests
A QName in the node test is expanded into an expanded-name using the
namespace declarations from the expression context. This is the same
way expansion is done for element type names in start and end-tags
<bold>except that the default namespace declared with xmlns is not
used: if the QName does not have a prefix, then the namespace URI is
null</bold> (this is the same way attribute names are expanded). It is
an error if the QName has a prefix for which there is no namespace
declaration in the expression context.
this changes in XPath 2.0 (http://www.w3.org/TR/xpath20/#node-tests);
you can define what the deafult element/type namespace is as another
element of the expression context:
A QName in a name test is expanded into an expanded-QName using the
in-scope namespaces in the expression context. It is a static error
[err:XP0008] if the QName has a prefix that does not correspond to any
in-scope namespace. An unprefixed QName, when used as a name test on
an axis whose principal node kind is element, has the namespace URI of
the default element/type namespace in the expression context;
otherwise, it has no namespace URI.
Of course, XPath 2.0 isn't finished yet :)
-David Waite
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic