xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elliotte Harold <elh...@metalab.unc.edu>
Subject Re: how do I detect internal subset when part of external subset?
Date Tue, 04 Apr 2006 11:41:36 GMT
The trick is to look for the entity name "[dtd]". XOM accomplishes this 
thusly using pure SAX:


     protected boolean inExternalSubset = false;

     // We have a problem here. Xerces gets this right,
     // but Crimson and possibly other parsers don't properly
     // report these entities, or perhaps just not tag them
     // with [dtd] like they're supposed to.
     public void startEntity(String name) {
       if (name.equals("[dtd]")) inExternalSubset = true;
     }


     public void endEntity(String name) {
       if (name.equals("[dtd]")) inExternalSubset = false;
     }

You can just reverse the logic if you prefer inInternalSubset.

-- 
´╗┐Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message