[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Namespace Selection using SelectionNamespaces property


selectionnamespaces
Hi Jason,

> 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.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.