Lists Home |
Date Index |
- To: "XML-DEV (E-mail)" <firstname.lastname@example.org>
- Subject: [xml-dev] Namespace Selection using SelectionNamespaces property
- From: Jason Brown <Jason@i2.co.uk>
- Date: Thu, 9 Jan 2003 13:05:38 -0000
Title: [xml-dev] Namespace Selection using SelectionNamespaces property
From: Jason Brown
Sent: 09 January 2003 13:05
To: 'Jeni Tennison'
Subject: RE: [xml-dev] Namespace Selection using SelectionNamespaces
and apologies for me not picking that up from your first mail. ** I am not worthy!! **
From: Jeni Tennison [mailto:email@example.com]
Sent: 09 January 2003 13:04
To: Jason Brown
Cc: XML-DEV (E-mail)
Subject: Re: [xml-dev] Namespace Selection using SelectionNamespaces
> The code works fine as long as I specify the namespace at every level
> eg i2:Environment/i2:Defaults
> What I would like to do is set i2 as a default namespace so I can
> minimise the amount of typing for retrieval.
> eg Environment/Defaults
> I have tried not specifying a prefix in the SelectionNamespaces
> property, however this does not work, I just get an XPath error
As I explained, in XPath an element name without a prefix is *always*
interpreted as refering to an element that belongs to no namespace.
You can't declare a default namespace for the interpretation of
element names in XPath 1.0.
However, this *is* something that is included in XPath 2.0. So give it
another year or so (for XPath 2.0 to reach Recommendation and be
implemented by Microsoft) and you'll be able to do what you want to
do. In the meantime, declare a single-letter prefix and use that
everywhere -- it's only two characters on each element name and it
does make it clearer what kinds of elements your referring to.
Or of course you could stop using namespaces in your XML document, but
I wouldn't really recommend that.