If I understand XML::Parser, the ExternEnt handler is used for entities that refer to external files, but I don'think there is any built-in way to get to the DTD, and to the info inside it. Actually if I read the code in XML::Twig properly (I wrote it quite a while ago), it just parses the DTD with a dummy document, gets the entity info, and uses it later when parsing the main document. And "I don't like to do that, but it solves my problem" ;--(
About entities in attributes: the Default handler is properly called when an entity is found in an attribute value, but the problem is that you can't do much at this point, and when the Start handler is called, the entity has disapeared from the attribute value that gets passed to it. Which is really annoying, especially as the default entities ('&', '<', '>'...) get properly replaced.
For example this is scary, and shows that there isn't much that can be done that will work in all cases:
#!/usr/bin/perl -w
use strict;
use XML::Parser;
XML::Parser->new( Handlers => { Start => sub { print "att: '$_[3]'\n"
+} })
->parse( '<!DOCTYPE doc SYSTEM "dummy"><doc att="an &ent; a
+nd an &ent;"/>');
# prints att: 'an and an &ent;'
|