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

Re: Re: determining ID-ness in XML

  • From: David Carlisle <davidc@n...>
  • To: veillard@r...
  • Date: Thu, 01 Nov 2001 09:32:52 +0000 (GMT)

xpath id


> > 	/ descendants-or-self::*[attval::*[local-name() = 'id'] = 'foo'][1]
> > 
> > An inelegant solution to be sure.  (Though this is basically
> > what I always do anyway when I need to identify IDs, since
> > in practice it's more reliable than anything else.)
> 
>   This was looked at. And existing DTDs with id attributes not of type
> ID seems to exist. This totally break them, and make pointing unreliable
> because a lot of tools expects #foo to point to the ID of name foo, and
> you could actually end up pointing to a different part of the document
> against the author(s) intent. Compatibility with the XPath id() function
> was considered really important too.
> 
> Daniel
> 

A version of the definition that would address both those concerns is:

#foo means:

id('foo')|/*[not(id('foo'))]/descendant-or-self::*[@*[local-name()='id' and . = 'foo']][1]

ie, use (the first) element node with ID 'foo' if one exists otherwise use the
first element node with an attribute in any (or no) namespace with local
name 'id' and value 'foo'.

This does have some advantages in that like the Xpath id() function it
doesn't impose any requirememts on the parsers to check any new kind of
uniqueness constraint, and so doesn't require changes to current systems
(except systems implementing fragment id's pointing to xml files, and
these are rather thin on the ground, currently).

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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.