[jdom-interest] SAXBuilder inclusion of default attributes

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue Jan 20 05:43:07 PST 2004


At 8:43 PM -0800 1/19/04, Harry Evans wrote:
>Thanks for the tip.  Unfortunately, it seems that neither xerces nor 
>crimson allow this flag to be set.  I get the following when I try 
>to set the feature value to false:
>org.jdom.JDOMException: 
>http://xml.org/sax/features/external-general-entities feature not 
>supported for SAX driver org.apache.xerces.parsers.SAXParser
>    at org.jdom.input.SAXBuilder.internalSetFeature(SAXBuilder.java:643)
>    at org.jdom.input.SAXBuilder.setFeaturesAndProperties(SAXBuilder.java:585)
>    at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:467)
>    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:341)
>    at org.jdom.input.SAXBuilder.build(SAXBuilder.java:684)
><etc>
>

You probably need to set it before you construct the SAXBuilder. Set 
it directly on the XMLReader, not through JDOM.

Xerces also has a couple of other features that might help:

http://apache.org/xml/features/nonvalidating/load-external-dtd
http://apache.org/xml/features/nonvalidating/load-dtd-grammar

Try setting both of these to false; again, before you give the 
XMLReader to JDOM.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml            
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA 



More information about the jdom-interest mailing list