Joris Gillis wrote:
> Is it really necessary to define the whole DTD? Can one not specify the
> attribute that is of type ID without including any other document
> definition?
With a DTD you need to define the attribute for each element you want to
use it on.
I am not sure what is supposed to happen if you do not define the
elements but then specify attributes but it is certainly not reliable
thing to do.
In my tests here with MSXML 3 and with .NET XmlDocument elements are not
found by id (using the nodeFromID function in MSXML and GetElementById
with .NET) if only attributes are defined.
Mozilla with getElementById finds the elements if only the attributes
are defined. But Mozilla only processes internal subsets of DTDs so in
many cases you can't rely on ID attributes and getElementById.
There is a new W3C recommendation for the xml:id attribute
<http://www.w3.org/TR/xml-id/>
if that is going to be implemented then no DTD should be required to
make use of getElementById.
--
Martin Honnen
http://JavaScript.FAQTs.com/