|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: SAX: Java-Specific Question
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? Tyler xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








