-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Bradford
> On Sunday, January 6, 2002, at 12:13 PM, Timothy M. Dean wrote:
> > Note that at the current time, it does not appear that this
mechanism
> > works when you set a default namespace. However, it does work well
when 
> > mapping specific prefixes to a namespace URI.
>
> Is this a problem with the Xindice implementation, or the querying 
> approach in general?

I believe it is a problem with the Xindice (or possibly Xalan or Xerces)
implementation. Read on for my justification.

> I started thinking about this problem recently, and here's where I see

> the flaw is.  Say you have a document with a defaulted namespace
nested 
> deep within it, but no namespaced nodes in tree before that.

First point: I don't think that how the document's namespaces are
specified
(default or explicit) matters in the least. The document, as stored in
the
DB contains elements/attributes with local names and optional namespace
URI's.
The prefixes used for explicit identification and the default namespace
identification are simply syntactic mechanisms to tell parsers what
namespace URI's to apply to what elements. 

>  Then, you 
> create a namespace mapping for an XPath query that has a defaulted 
> namespace that matches the deeply nested default namespace.  Unless
you 
> use a // query, there will be absolutely no way for the XPath
processor 
> to traverse to the node with the defaulted namespace, because it can 
> only see non-prefixed node references as being part of the mapped 
> default namespace.

Generally, if you have some namespaced elements in a document, then all
will be namespaced. While this is not a requirement it seems to be far
and away the most common usage. Even so, those few cases which might try
this approach have an easy option. If parts of their documents contain
no namespace identifications, then they should not be using default
namespaces in their XPath queries: It simply does not make sense for
them. These few cases could be solved very eaily by only setting
namespaces for certain prefixes.

> Therefore, I recommend not even having a default namespace as part of 
> the Namespace mapping system.  If you're going to use a namespace as 
> part of your query, then you need to prefix it to avoid this potential

> problem.
> Then again, I don't even believe that XML should have default 
> namespaces, so what do I know.

I agree that default namespaces are not absolutely necessary. One can
always use explicit namespace prefixes. However, it can simplify things
significantly when working with an XPath query that uses only one
namespace, or that uses one namespace for most of its
elements/attributes.

I've found the use of default namespaces to be an unnecessary but
helpful option in most recent XML designs I've done for clients. Because
XPath queries tend to be smaller and less complex then entire XML
documents, I can sypathize with the argument that it shouldn't be needed
for XPath queries, especially if it would require significant amounts of
work. However, default namespaces are in the XML namespace spec, they
are supported by Xerces, they are supported by Xalan, and all of the
hard parts in Xindice are already taken care of when handling explicit
namespaces. There really is no significant reason I can think of to
*not* include default namespace support within Xindice.

- Tim


----------------------------------------------------------------------
Post a message:         mailto:[EMAIL PROTECTED]
Unsubscribe:            mailto:[EMAIL PROTECTED]
Contact administrator:  mailto:[EMAIL PROTECTED]
Read archived messages: http://archive.xmldb.org/
----------------------------------------------------------------------

Reply via email to