OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Possible parse() overloading bug in XMLFilterImpl

[ Lists Home | Date Index | Thread Index ]
  • From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
  • To: xml-dev@xml.org
  • Date: Wed, 8 Mar 2000 21:00:35 -0500

I first thought this was a bug in my parser but it's been pointed out 
to me that Xerces just inherited it from SAX.

The SAX 2 documentation states in the API docs for XMLReader:

public void parse(java.lang.String systemId)
            throws java.io.IOException,
                   SAXException

      Parse an XML document from a system identifier (URI).

      This method is a shortcut for the common case of reading a document
from a system identifier. It is the exact equivalent of the following:

       parse(new InputSource(systemId));
 
Notice the phrase "exact equivalent". In the XMLFilterImpl class the 
parse(systemId) method is defined as follows:

     public void parse (String systemId)
         throws SAXException, IOException
     {
         setupParse();
         parent.parse(systemId);
     }

The result is that overriding parse(InputSource in) does not change the
behavior of parse (String systemId) so they are not exactly equivalent.
What I suspect it should do is:

     public void parse (String systemId)
         throws SAXException, IOException
     {
         parse(new InputSource(systemId));
     }

No similar constraint is given in the Java docs for XMLFilterImpl, 
which does not implement XMLReader, so maybe there's a reason for 
these two to behave differently. But it seems suspicious to me. Since 
XMLFilterImpl implements XMLFilter which extends XMLReader, I'd 
expect the constraints to inherit through.

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS