Re: Attribute types in DOM Level 3

Elliotte Rusty Harold wrote:

>
> I have previously suggested that DOM Level 3 add some form of 
> getType() method to the Attr interface to report the type of the 
> attribute declared in a DTD. One important use-case for this 
> information is any XPath based application such as XSLT and XPointer 
> which need to behave differently depending on which attributes have 
> type ID.
>
> I was told that this information would be available through abstract 
> schemas. Now that abstract schemas has gone to that great web site in 
> the sky, I'd like to reraise this issue. I think a simple method in 
> the Attr interface which returns the type as declared by the DTD is 
> important. I think this is a separate issue from the type declared by 
> any schema, since a document may have both a DTD and a schema. How to 
> handle this for schemas is relatively hard, but handling it for DTDs 
> is not. SAX has been doing this for several years 9albeit with a few 
> bugs in both interface and implementations.) The exact signature and 
> behavior can be discussed, but I would really like to have this 
> information available as a standard part of DOM.

I think the general dropping of Abstract Schema will not generally cause 
a new DTD-specific API to emerge.  At least this is not currently within 
the work of the DOM WG.

On the other hand ID's has been something that the specification has 
dealt with in the past.  As long as you stick to IDs of the type defined 
by DTDs, I don't think it is a stretch to say that the same 
functionality would be expected to work in XML Schema, which has direct 
support for this type, if you are not distracted by all the additional 
keys it supports.

Exposing this by supporting Document.getElementByID has always been 
optional, allowing for non-validating parsers.

What if there were a boolean read-only attribute on an attribute node to 
identify attribute nodes known to be ID's -- would this be enough to be 
useful?  Obviously on non-validating parsers, the boolean would always 
be false.  Or would you require something more to solve the problem?

Ray Whitmer
rayw@netscape.com

Received on Monday, 29 July 2002 12:51:12 UTC