setEntityResolver(null)
Elliotte Rusty Harold <[email protected]> Mon, 31 Mar 2003 14:15:26 -0500
| Newsgroups | gmane.text.xml.sax.devel |
|---|---|
| Message-ID | <p04330105baae3c0785ab@[192.168.254.4]> |
XOM user Nils Kilden-Pedersen has reported a bug that his parser is throwing a NullPointerException because XOM calls setEntityResolver(null) at one point inside the Builder class (which sits on top of a SAX parser). I'm still trying to determine exactly which SAX parser he's using (probably Xerces or Crimson), and I can probably work around this, but in the meantime he has raised an issue about the proper behavior of SAX. It has previously been my understanding that you can remove an EntityResolver, and the various other listeners set on a XMLReader by passing null to the appropriate setter method such as setEntityResolver. The SAX API documentation does not justify this, but it doesn't say it's prohibited either. See http://www.saxproject.org/apidoc/org/xml/sax/XMLReader.html#setEntityResolver(org.xml.sax.EntityResolver) However, my user pointed out to me that the version of the SAX API documentation included with J2EE does state that this method throws a NullPointerException. See http://java.sun.com/j2ee/sdk_1.3/techdocs/api/org/xml/sax/XMLReader.html#setEntityResolver(org.xml.sax.EntityResolver) I am requesting discussion and official resolution of whether or not its acceptable to pass null to setEntityResolver to remove any currently installed EntityResolver. Personally, since there's no other way to remove an EntityResolver without providing a new one, I think this is necessary. However, whatever the decision I would like to ask that the answer be explicitly placed in the official SAX docs. I think we probably also need to ask and answer this question for the other setter methods: setContentHandler, setDTDHandler, etc. and perhaps also for the extensions such as LexicalHandler and DeclHandler that are set via properties. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | [email protected] | Writer/Programmer | +-----------------------+------------------------+-------------------+ | Processing XML with Java (Addison-Wesley, 2002) | | http://www.cafeconleche.org/books/xmljava | | http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ List: sax-devel, [email protected] See: http://www.saxproject.org/ https://lists.sourceforge.net/lists/listinfo/sax-devel