OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] Re: determining ID-ness in XML





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