Page 1 of 1

DTD validation for unused elements

Posted: Sat Jun 28, 2008 7:03 pm
by DavidNelson
Greetings all -- I'm a newbie here with a novice-level problem. Hopefully some kind XML geek will help me out! I'm using Oxygen 9.2 and am working on some DTD modifications. In the past, I seem to remember being notified of elements in the DTD that are declared, but not actually used in any element models. This (as I remember) happened simply by validating the DTD document.

Now, while any DTD errors are reported, unused elements are not flagged. Thanks in advance for help to solve this mystery.

-David

Re: DTD validation for unused elements

Posted: Mon Jun 30, 2008 10:44 am
by sorin_ristache
Hello,

No, an XML validator is not required to report elements that are declared in a DTD but not used in an element model in the DTD or in an XML document validated against that DTD. If I remember correctly there is no XML validator that had any version that reported unused elements of a DTD. I think you need to create a special application for checking such element names.


Regards,
Sorin

Re: DTD validation for unused elements

Posted: Tue Jul 01, 2008 1:05 am
by DavidNelson
Thanks Sorin, for the feedback. Now I realize that (as Roger Clemens might have put it) I "misremembered" the situation I had dealt with in the past. The problem I dealt with before was removed/undeclared elements being used in active element models -- causing DTD error warnings.

It makes sense that the parser would not balk at seeing a legally declared element even though it is not used anywhere.

-David