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


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: SAX: Java-Specific Question

[ Lists Home | Date Index | Thread Index ]
  • From: Tyler Baker <tyler@infinet.com>
  • To: David Megginson <ak117@freenet.carleton.ca>
  • Date: Fri, 03 Apr 1998 23:29:20 -0500

David Megginson wrote:

> Here's a Java question.  Let's say that I have a class with a method
>   public void parse (String publicId, String systemId, Reader reader)
>     throws java.lang.Exception;
> What will happen if the "java.io.Reader" class is not available on my
> system (perhaps because I'm using a 1.0.2 browser), but I never invoke
> this method (I'm assuming that I compiled my code under JDK 1.1 or JDK
> 1.2)?

Well this deals with the issue of backward compatibility.  Classes like
java.awt.Component may elect to add new methods, but they must still support the
old ones.  Having an additional public void parse(String publicID, String
systemID, Reader reader) would not be a problem for old 1.0.2 programs at run
time since the JVM only loads classes (new ones) as it needs them.  So if you
never invoke a method with a reader class, then the reader class will never ever
get a chance to try and be initialized (which is good cause otherwise you would
get a ClassNotFoundException).

An example of this is with the AWT.  With JDK 1.1 a lot of new methods were added
to java.awt.Component (a bunch more are being added in JDK 1.2 as well).  If I
have a compiled applet for JDK 1.1, it should work in a JDK 1.2 environment
because none of the JDK 1.1 methods were removed, only new ones were added.

> I'm becoming convinced that we need to support character streams in
> SAX, and I'm trying to figure out how to handle it in the Java
> version -- I think that I've worked out pretty much everything else
> now, except for a few minor details.

It is really not a problem to do what you are talking about from a compatibility
standpoint and I have wondered why this was not done earlier.

One major question I have is regarding character support in Java.  If you look at
the XML spec, there are a lot of differences between the tables of what is
whitespace, legal unicode characters, etc. which make it so parser writers need
to write their own isWhitespace(char c) functions instead of using
Character.isWhitespace().  In this particular case, Java sees a Form Feed as
white space while the XML spec does not.  Does anyone have any ideas as to why
there are so many inconsistencies?


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


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

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