Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: setProperty, selectionNamespaces, defaultNamespace

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 11/2/2006 3:36:00 PM

Alexander Schneider wrote:

>> XPath 1.0 does not know anything like a default namespace thus the XPath 
>> expression //element always selects elements with the local name 
>> |element| in _no_ namespace.
> 
> I use a workaround and add for the default namespace the prefix "default". 
> Now my "selection Namespace" property was set to


> xmlns:default="http://www.w3.org/2001/XMLSchema"
> 
> but I can't select something like "//element" but "//default:element" works 
> fine. 

That is not a work around but required by the way XPath 1.0 works. As I 
said already, in XPath 1.0 //element always selects elements in no 
namespace. XPath 1.0 does not know any default namespace declaration. If 
you want to select elements in a namespace (whether it is defined as a 
default namespace or not does not matter in terms of XPath) with an 
XPath 1.0 expression then you need to use e.g. //prefix:element where it 
depends on your XPath API how to bind that prefix to a namespace URI. So 
I suggested to choose a prefix and you have done so with "default" I 
think, now you can use XPath expressions like //default:element and that 
is the only way to select elements in a namespace with XPath 1.0.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent