Return-Path: Mailing-List: contact commons-cvs-help@xml.apache.org; run by ezmlm Delivered-To: mailing list commons-cvs@xml.apache.org Received: (qmail 48858 invoked from network); 10 May 2002 20:42:40 -0000 Received: from icarus.apache.org (63.251.56.143) by daedalus.apache.org with SMTP; 10 May 2002 20:42:40 -0000 Received: (qmail 35993 invoked by uid 1014); 10 May 2002 20:42:39 -0000 Date: 10 May 2002 20:42:39 -0000 Message-ID: <20020510204239.35992.qmail@icarus.apache.org> From: sboag@apache.org To: xml-commons-cvs@apache.org Subject: cvs commit: xml-commons/java/external/src/org/xml/sax/helpers AttributeListImpl.java AttributesImpl.java DefaultHandler.java LocatorImpl.java NamespaceSupport.java NewInstance.java ParserAdapter.java ParserFactory.java XMLFilterImpl.java XMLReaderAdapter.java XMLReaderFactory.java package.html X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N sboag 02/05/10 13:42:39 Modified: java/external/src Tag: RIVERCOURT1 manifest.commons java/external/src/javax/xml/parsers Tag: RIVERCOURT1 DocumentBuilderFactory.java SAXParser.java SAXParserFactory.java java/external/src/javax/xml/transform Tag: RIVERCOURT1 TransformerFactory.java java/external/src/org/xml/sax Tag: RIVERCOURT1 AttributeList.java Attributes.java ContentHandler.java DTDHandler.java DocumentHandler.java EntityResolver.java ErrorHandler.java HandlerBase.java InputSource.java Locator.java Parser.java SAXException.java SAXNotRecognizedException.java SAXNotSupportedException.java SAXParseException.java XMLFilter.java XMLReader.java package.html java/external/src/org/xml/sax/ext Tag: RIVERCOURT1 DeclHandler.java LexicalHandler.java package.html java/external/src/org/xml/sax/helpers Tag: RIVERCOURT1 AttributeListImpl.java AttributesImpl.java DefaultHandler.java LocatorImpl.java NamespaceSupport.java NewInstance.java ParserAdapter.java ParserFactory.java XMLFilterImpl.java XMLReaderAdapter.java XMLReaderFactory.java package.html Log: Match Xerces code directly for SAX and javax.xml.parsers. Add default factory for Xerces. Change manifest for sax, parsers, and transform, to append "_ibm_1" to the implementation version property. Revision Changes Path No revision No revision 1.1.2.1 +3 -3 xml-commons/java/external/src/manifest.commons Index: manifest.commons =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/manifest.commons,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- manifest.commons 28 Nov 2001 19:38:44 -0000 1.1 +++ manifest.commons 10 May 2002 20:42:37 -0000 1.1.2.1 @@ -14,7 +14,7 @@ Specification-Vendor: David Megginson Specification-Version: 2.0 Implementation-Title: org.xml.sax -Implementation-Version: 2.0 +Implementation-Version: 2.0_ibm_1 Implementation-Vendor: David Megginson Implementation-URL: http://www.megginson.com/SAX/index.html @@ -34,7 +34,7 @@ Specification-Version: 1.1 Specification-Vendor: Sun Microsystems Inc. Implementation-Title: javax.xml.transform -Implementation-Version: 1.1.2 +Implementation-Version: 1.1.2_ibm_1 Implementation-Vendor: Sun Microsystems Inc. Implementation-URL: http://java.sun.com/xml/jaxp.html @@ -44,6 +44,6 @@ Specification-Version: 1.1 Specification-Vendor: Sun Microsystems Inc. Implementation-Title: javax.xml.transform -Implementation-Version: 1.1.2 +Implementation-Version: 1.1.2_ibm_1 Implementation-Vendor: Sun Microsystems Inc. Implementation-URL: http://java.sun.com/xml/jaxp.html No revision No revision 1.3.2.1 +1 -1 xml-commons/java/external/src/javax/xml/parsers/DocumentBuilderFactory.java Index: DocumentBuilderFactory.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/parsers/DocumentBuilderFactory.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- DocumentBuilderFactory.java 12 Oct 2001 23:44:49 -0000 1.3 +++ DocumentBuilderFactory.java 10 May 2002 20:42:38 -0000 1.3.2.1 @@ -140,7 +140,7 @@ /* The default property name according to the JAXP spec */ "javax.xml.parsers.DocumentBuilderFactory", /* The fallback implementation class name */ - null); + "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); } catch (FactoryFinder.ConfigurationError e) { throw new FactoryConfigurationError(e.getException(), e.getMessage()); 1.3.4.1 +1 -0 xml-commons/java/external/src/javax/xml/parsers/SAXParser.java Index: SAXParser.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/parsers/SAXParser.java,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -u -r1.3 -r1.3.4.1 --- SAXParser.java 28 Jun 2001 23:12:24 -0000 1.3 +++ SAXParser.java 10 May 2002 20:42:38 -0000 1.3.4.1 @@ -353,6 +353,7 @@ } Parser parser = this.getParser(); + if (hb != null) { parser.setDocumentHandler(hb); parser.setEntityResolver(hb); 1.4.2.1 +1 -1 xml-commons/java/external/src/javax/xml/parsers/SAXParserFactory.java Index: SAXParserFactory.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/parsers/SAXParserFactory.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -r1.4 -r1.4.2.1 --- SAXParserFactory.java 12 Oct 2001 23:44:49 -0000 1.4 +++ SAXParserFactory.java 10 May 2002 20:42:38 -0000 1.4.2.1 @@ -136,7 +136,7 @@ /* The default property name according to the JAXP spec */ "javax.xml.parsers.SAXParserFactory", /* The fallback implementation class name */ - null); + "org.apache.xerces.jaxp.SAXParserFactoryImpl"); } catch (FactoryFinder.ConfigurationError e) { throw new FactoryConfigurationError(e.getException(), e.getMessage()); No revision No revision 1.4.2.1 +1 -1 xml-commons/java/external/src/javax/xml/transform/TransformerFactory.java Index: TransformerFactory.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/transform/TransformerFactory.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -r1.4 -r1.4.2.1 --- TransformerFactory.java 22 Jan 2002 20:45:17 -0000 1.4 +++ TransformerFactory.java 10 May 2002 20:42:38 -0000 1.4.2.1 @@ -142,7 +142,7 @@ /* The default property name according to the JAXP spec */ "javax.xml.transform.TransformerFactory", /* The fallback implementation class name */ - null); + "org.apache.xalan.processor.TransformerFactoryImpl"); } catch (FactoryFinder.ConfigurationError e) { throw new TransformerFactoryConfigurationError(e.getException(), e.getMessage()); No revision No revision 1.2.2.1 +4 -6 xml-commons/java/external/src/org/xml/sax/AttributeList.java Index: AttributeList.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/AttributeList.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- AttributeList.java 27 Feb 2002 16:04:17 -0000 1.2 +++ AttributeList.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX Attribute List Interface. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: AttributeList.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: AttributeList.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -11,8 +10,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This is the original SAX1 interface for reporting an element's @@ -64,8 +61,9 @@ * {@link org.xml.sax.Attributes Attributes} * interface, which includes Namespace support. * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.DocumentHandler#startElement startElement * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl */ 1.2.2.1 +8 -17 xml-commons/java/external/src/org/xml/sax/Attributes.java Index: Attributes.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/Attributes.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Attributes.java 27 Feb 2002 16:04:17 -0000 1.2 +++ Attributes.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // Attributes.java - attribute list with Namespace support -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the public domain. -// $Id: Attributes.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: Attributes.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -15,8 +14,6 @@ *

* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This interface allows access to a list of attributes in @@ -33,13 +30,7 @@ * contain attributes used as Namespace declarations (xmlns*) unless * the http://xml.org/sax/features/namespace-prefixes * feature is set to true (it is false by - * default). - * Because SAX2 conforms to the "Namespaces in XML" specification, - * it does not give namespace declaration attributes a namespace URI. - * Some other W3C specifications are in conflict with that, expecting - * these declarations to be in a namespace. - * Handler code may need to resolve that conflict. - *

+ * default).

* *

If the namespace-prefixes feature (see above) is false, * access by qualified name may not be available; if the @@ -56,10 +47,10 @@ * vary from implementation to implementation.

* * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.helpers.AttributesImpl - * @see org.xml.sax.ext.DeclHandler#attributeDecl + * @author David Megginson, + * sax@megginson.com + * @version 2.0 + * @see org.xml.sax.helpers.AttributeListImpl */ public interface Attributes { @@ -176,7 +167,7 @@ * @return The index of the attribute, or -1 if it does not * appear in the list. */ - public int getIndex (String uri, String localName); + public int getIndex (String uri, String localPart); /** 1.2.2.1 +16 -50 xml-commons/java/external/src/org/xml/sax/ContentHandler.java Index: ContentHandler.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/ContentHandler.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ContentHandler.java 27 Feb 2002 16:04:17 -0000 1.2 +++ ContentHandler.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // ContentHandler.java - handle main document content. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the public domain. -// $Id: ContentHandler.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: ContentHandler.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -14,8 +13,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This is the main interface that most SAX applications @@ -51,8 +48,9 @@ * bug.

* * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.XMLReader * @see org.xml.sax.DTDHandler * @see org.xml.sax.ErrorHandler @@ -92,7 +90,8 @@ * Receive notification of the beginning of a document. * *

The SAX parser will invoke this method only once, before any - * other event callbacks (except for {@link #setDocumentLocator + * other methods in this interface or in {@link org.xml.sax.DTDHandler + * DTDHandler} (except for {@link #setDocumentLocator * setDocumentLocator}).

* * @exception org.xml.sax.SAXException Any SAX exception, possibly @@ -137,21 +136,18 @@ * itself, if necessary.

* *

Note that start/endPrefixMapping events are not - * guaranteed to be properly nested relative to each other: - * all startPrefixMapping events will occur immediately before the + * guaranteed to be properly nested relative to each-other: + * all startPrefixMapping events will occur before the * corresponding {@link #startElement startElement} event, * and all {@link #endPrefixMapping endPrefixMapping} - * events will occur immediately after the corresponding - * {@link #endElement endElement} event, - * but their order is not otherwise + * events will occur after the corresponding {@link #endElement + * endElement} event, but their order is not otherwise * guaranteed.

* *

There should never be start/endPrefixMapping events for the * "xml" prefix, since it is predeclared and immutable.

* * @param prefix The Namespace prefix being declared. - * An empty string is used for the default element namespace, - * which has no prefix. * @param uri The Namespace URI the prefix is mapped to. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. @@ -166,13 +162,12 @@ * End the scope of a prefix-URI mapping. * *

See {@link #startPrefixMapping startPrefixMapping} for - * details. These events will always occur immediately after the - * corresponding {@link #endElement endElement} event, but the order of + * details. This event will always occur after the corresponding + * {@link #endElement endElement} event, but the order of * {@link #endPrefixMapping endPrefixMapping} events is not otherwise * guaranteed.

* * @param prefix The prefix that was being mapping. - * This is the empty string when a default mapping scope ends. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. * @see #startPrefixMapping @@ -225,9 +220,6 @@ * property is true (it is false by default, and support for a * true value is optional).

* - *

Like {@link #characters characters()}, attribute values may have - * characters that need more than one char value.

- * * @param uri The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. @@ -244,7 +236,7 @@ * @see #endElement * @see org.xml.sax.Attributes */ - public void startElement (String uri, String localName, + public void startElement (String namespaceURI, String localName, String qName, Attributes atts) throws SAXException; @@ -270,7 +262,7 @@ * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ - public void endElement (String uri, String localName, + public void endElement (String namespaceURI, String localName, String qName) throws SAXException; @@ -288,23 +280,6 @@ *

The application must not attempt to read from the array * outside of the specified range.

* - *

Individual characters may consist of more than one Java - * char value. There are two important cases where this - * happens, because characters can't be represented in just sixteen bits. - * In one case, characters are represented in a Surrogate Pair, - * using two special Unicode values. Such characters are in the so-called - * "Astral Planes", with a code point above U+FFFF. A second case involves - * composite characters, such as a base character combining with one or - * more accent characters.

- * - *

Your code should not assume that algorithms using - * char-at-a-time idioms will be working in character - * units; in some cases they will split characters. This is relevant - * wherever XML permits arbitrary characters, such as attribute values, - * processing instruction data, and comments as well as in data reported - * from this method. It's also generally relevant whenever Java code - * manipulates internationalized text; the issue isn't unique to XML.

- * *

Note that some parsers will report whitespace in element * content using the {@link #ignorableWhitespace ignorableWhitespace} * method rather than this one (validating parsers must @@ -361,10 +336,6 @@ * section 2.8) or a text declaration (XML 1.0, section 4.3.1) * using this method.

* - *

Like {@link #characters characters()}, processing instruction - * data may have characters that need more than one char - * value.

- * * @param target The processing instruction target. * @param data The processing instruction data, or null if * none was supplied. The data does not include any @@ -378,13 +349,8 @@ /** * Receive notification of a skipped entity. - * This is not called for entity references within markup constructs - * such as element start tags or markup declarations. (The XML - * recommendation requires reporting skipped external entities. - * SAX also reports internal entity expansion/non-expansion, except - * within markup constructs.) * - *

The Parser will invoke this method each time the entity is + *

The Parser will invoke this method once for each entity * skipped. Non-validating processors may skip entities if they * have not seen the declarations (because, for example, the * entity was declared in an external DTD subset). All processors 1.2.2.1 +12 -21 xml-commons/java/external/src/org/xml/sax/DTDHandler.java Index: DTDHandler.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/DTDHandler.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- DTDHandler.java 27 Feb 2002 16:04:17 -0000 1.2 +++ DTDHandler.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX DTD handler. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: DTDHandler.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: DTDHandler.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -11,8 +10,6 @@ *

* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

If a SAX application needs information about notations and @@ -30,10 +27,7 @@ * of the order in which the notations and unparsed entities were * declared; however, all DTD events must be reported after the * document handler's startDocument event, and before the first - * startElement event. - * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is - * used, these events must also be reported before the endDTD event.) - *

+ * startElement event.

* *

It is up to the application to store the information for * future use (perhaps in a hash table or object tree). @@ -43,9 +37,11 @@ * notation corresponding with the attribute value.

* * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.XMLReader#setDTDHandler + * @author David Megginson, + * sax@megginson.com + * @version 2.0 + * @see org.xml.sax.Parser#setDTDHandler + * @see org.xml.sax.HandlerBase */ public interface DTDHandler { @@ -54,10 +50,7 @@ * Receive notification of a notation declaration event. * *

It is up to the application to record the notation for later - * reference, if necessary; - * notations may appear as attribute values and in unparsed entity - * declarations, and are sometime used with processing instruction - * target names.

+ * reference, if necessary.

* *

At least one of publicId and systemId must be non-null. * If a system identifier is present, and it is a URL, the SAX @@ -75,7 +68,7 @@ * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see #unparsedEntityDecl - * @see org.xml.sax.Attributes + * @see org.xml.sax.AttributeList */ public abstract void notationDecl (String name, String publicId, @@ -89,9 +82,7 @@ *

Note that the notation name corresponds to a notation * reported by the {@link #notationDecl notationDecl} event. * It is up to the application to record the entity for later - * reference, if necessary; - * unparsed entities may appear as attribute values. - *

+ * reference, if necessary.

* *

If the system identifier is a URL, the parser must resolve it * fully before passing it to the application.

@@ -102,9 +93,9 @@ * @param publicId The entity's public identifier, or null if none * was given. * @param systemId The entity's system identifier. - * @param notationName The name of the associated notation. + * @param notation name The name of the associated notation. * @see #notationDecl - * @see org.xml.sax.Attributes + * @see org.xml.sax.AttributeList */ public abstract void unparsedEntityDecl (String name, String publicId, 1.2.2.1 +4 -6 xml-commons/java/external/src/org/xml/sax/DocumentHandler.java Index: DocumentHandler.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/DocumentHandler.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- DocumentHandler.java 27 Feb 2002 16:04:17 -0000 1.2 +++ DocumentHandler.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX document handler. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: DocumentHandler.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: DocumentHandler.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -11,8 +10,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This was the main event-handling interface for SAX1; in @@ -38,8 +35,9 @@ * {@link org.xml.sax.ContentHandler ContentHandler} * interface, which includes Namespace support. * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.Parser#setDocumentHandler * @see org.xml.sax.Locator * @see org.xml.sax.HandlerBase 1.2.2.1 +12 -21 xml-commons/java/external/src/org/xml/sax/EntityResolver.java Index: EntityResolver.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/EntityResolver.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- EntityResolver.java 27 Feb 2002 16:04:17 -0000 1.2 +++ EntityResolver.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX entity resolver. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: EntityResolver.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: EntityResolver.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -14,8 +13,6 @@ *

* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

If a SAX application needs to implement customized handling @@ -61,9 +58,10 @@ * (possibly by using the public identifier).

* * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.XMLReader#setEntityResolver + * @author David Megginson, + * sax@megginson.com + * @version 2.0 + * @see org.xml.sax.Parser#setEntityResolver * @see org.xml.sax.InputSource */ public interface EntityResolver { @@ -72,26 +70,19 @@ /** * Allow the application to resolve external entities. * - *

The parser will call this method before opening any external - * entity except the top-level document entity. Such entities include - * the external DTD subset and external parameter entities referenced - * within the DTD (in either case, only if the parser reads external - * parameter entities), and external general entities referenced - * within the document element (if the parser reads external general - * entities). The application may request that the parser locate + *

The Parser will call this method before opening any external + * entity except the top-level document entity (including the + * external DTD subset, external entities referenced within the + * DTD, and external entities referenced within the document + * element): the application may request that the parser resolve * the entity itself, that it use an alternative URI, or that it - * use data provided by the application (as a character or byte - * input stream).

+ * use an entirely different input source.

* *

Application writers can use this method to redirect external * system identifiers to secure and/or local URIs, to look up * public identifiers in a catalogue, or to read an entity from a * database or other input source (including, for example, a dialog - * box). Neither XML nor SAX specifies a preferred policy for using - * public or system IDs to resolve resources. However, SAX specifies - * how to interpret any InputSource returned by this method, and that - * if none is returned, then the system ID will be dereferenced as - * a URL.

+ * box).

* *

If the system identifier is a URL, the SAX parser must * resolve it fully before reporting it to the application.

1.2.2.1 +5 -7 xml-commons/java/external/src/org/xml/sax/ErrorHandler.java Index: ErrorHandler.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/ErrorHandler.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ErrorHandler.java 27 Feb 2002 16:04:17 -0000 1.2 +++ ErrorHandler.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX error handler. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: ErrorHandler.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: ErrorHandler.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -12,8 +11,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

If a SAX application needs to implement customized error @@ -36,9 +33,10 @@ * could catch an exception and report a fatalError).

* * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.XMLReader#setErrorHandler + * @author David Megginson, + * sax@megginson.com + * @version 2.0 + * @see org.xml.sax.Parser#setErrorHandler * @see org.xml.sax.SAXParseException */ public interface ErrorHandler { 1.2.2.1 +4 -6 xml-commons/java/external/src/org/xml/sax/HandlerBase.java Index: HandlerBase.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/HandlerBase.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- HandlerBase.java 27 Feb 2002 16:04:17 -0000 1.2 +++ HandlerBase.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX default handler base class. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: HandlerBase.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: HandlerBase.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -11,8 +10,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This class implements the default behaviour for four SAX1 @@ -35,8 +32,9 @@ * {@link org.xml.sax.helpers.DefaultHandler DefaultHandler} * class. * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.EntityResolver * @see org.xml.sax.DTDHandler * @see org.xml.sax.DocumentHandler 1.2.2.1 +17 -32 xml-commons/java/external/src/org/xml/sax/InputSource.java Index: InputSource.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/InputSource.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- InputSource.java 27 Feb 2002 16:04:17 -0000 1.2 +++ InputSource.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX input source. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: InputSource.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: InputSource.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -14,8 +13,6 @@ *

* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This class allows a SAX application to encapsulate information @@ -23,36 +20,28 @@ * a public identifier, a system identifier, a byte stream (possibly * with a specified encoding), and/or a character stream.

* - *

There are two places that the application can deliver an + *

There are two places that the application will deliver this * input source to the parser: as the argument to the Parser.parse * method, or as the return value of the EntityResolver.resolveEntity * method.

* *

The SAX parser will use the InputSource object to determine how * to read XML input. If there is a character stream available, the - * parser will read that stream directly, disregarding any text - * encoding declaration found in that stream. - * If there is no character stream, but there is - * a byte stream, the parser will use that byte stream, using the - * encoding specified in the InputSource or else (if no encoding is - * specified) autodetecting the character encoding using an algorithm - * such as the one in the XML specification. If neither a character - * stream nor a + * parser will read that stream directly; if not, the parser will use + * a byte stream, if available; if neither a character stream nor a * byte stream is available, the parser will attempt to open a URI * connection to the resource identified by the system * identifier.

* *

An InputSource object belongs to the application: the SAX parser * shall never modify it in any way (it may modify a copy if - * necessary). However, standard processing of both byte and - * character streams is to close them on as part of end-of-parse cleanup, - * so applications should not attempt to re-use such streams after they - * have been handed to a parser.

+ * necessary).

* * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 + * @see org.xml.sax.Parser#parse * @see org.xml.sax.EntityResolver#resolveEntity * @see java.io.InputStream * @see java.io.Reader @@ -80,8 +69,7 @@ * public identifier as well, or setEncoding to specify * the character encoding, if known.

* - *

If the system identifier is a URL, it must be fully - * resolved (it may not be a relative URL).

+ *

If the system identifier is a URL, it must be full resolved.

* * @param systemId The system identifier (URI). * @see #setPublicId @@ -99,9 +87,9 @@ /** * Create a new input source with a byte stream. * - *

Application writers should use setSystemId() to provide a base - * for resolving relative URIs, may use setPublicId to include a - * public identifier, and may use setEncoding to specify the object's + *

Application writers may use setSystemId to provide a base + * for resolving relative URIs, setPublicId to include a + * public identifier, and/or setEncoding to specify the object's * character encoding.

* * @param byteStream The raw byte stream containing the document. @@ -120,8 +108,8 @@ /** * Create a new input source with a character stream. * - *

Application writers should use setSystemId() to provide a base - * for resolving relative URIs, and may use setPublicId to include a + *

Application writers may use setSystemId() to provide a base + * for resolving relative URIs, and setPublicId to include a * public identifier.

* *

The character stream shall not include a byte order mark.

@@ -181,8 +169,7 @@ * object pointed to by the system identifier, it can register * the encoding using the setEncoding method.

* - *

If the system identifier is a URL, it must be fully - * resolved (it may not be a relative URL).

+ *

If the system ID is a URL, it must be fully resolved.

* * @param systemId The system identifier as a string. * @see #setEncoding @@ -204,7 +191,7 @@ * *

If the system ID is a URL, it will be fully resolved.

* - * @return The system identifier, or null if none was supplied. + * @return The system identifier. * @see #setSystemId * @see #getEncoding */ @@ -276,8 +263,6 @@ /** * Get the character encoding for a byte stream or URI. - * This value will be ignored when the application provides a - * character stream. * * @return The encoding, or null if none was supplied. * @see #setByteStream 1.2.2.1 +19 -29 xml-commons/java/external/src/org/xml/sax/Locator.java Index: Locator.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/Locator.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Locator.java 27 Feb 2002 16:04:17 -0000 1.2 +++ Locator.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX locator interface for document events. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: Locator.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: Locator.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -12,8 +11,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

If a SAX parser provides location information to the SAX @@ -21,13 +18,13 @@ * passing an instance to the application using the content * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator * setDocumentLocator} method. The application can use the - * object to obtain the location of any other SAX event + * object to obtain the location of any other content handler event * in the XML source document.

* *

Note that the results returned by the object will be valid only - * during the scope of each callback method: the application + * during the scope of each content handler method: the application * will receive unpredictable results if it attempts to use the - * locator at any other time, or after parsing completes.

+ * locator at any other time.

* *

SAX parsers are not required to supply a locator, but they are * very strongly encouraged to do so. If the parser supplies a @@ -38,8 +35,9 @@ * available.

* * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.ContentHandler#setDocumentLocator */ public interface Locator { @@ -67,9 +65,7 @@ * triggering the event appears.

* *

If the system identifier is a URL, the parser must resolve it - * fully before passing it to the application. For example, a file - * name must always be provided as a file:... URL, and other - * kinds of relative URI are also resolved against their bases.

+ * fully before passing it to the application.

* * @return A string containing the system identifier, or null * if none is available. @@ -80,16 +76,11 @@ /** * Return the line number where the current document event ends. - * Lines are delimited by line ends, which are defined in - * the XML specification. * *

Warning: The return value from the method - * is intended only as an approximation for the sake of diagnostics; - * it is not intended to provide sufficient information - * to edit the character content of the original XML document. - * In some cases, these "line" numbers match what would be displayed - * as columns, and in others they may not match the source text - * due to internal entity expansion.

+ * is intended only as an approximation for the sake of error + * reporting; it is not intended to provide sufficient information + * to edit the character content of the original XML document.

* *

The return value is an approximation of the line number * in the document entity or external parsed entity where the @@ -97,7 +88,7 @@ * *

If possible, the SAX driver should provide the line position * of the first character after the text associated with the document - * event. The first line is line 1.

+ * event. The first line in the document is line 1.

* * @return The line number, or -1 if none is available. * @see #getColumnNumber @@ -107,20 +98,19 @@ /** * Return the column number where the current document event ends. - * This is one-based number of Java char values since - * the last line end. * *

Warning: The return value from the method - * is intended only as an approximation for the sake of diagnostics; - * it is not intended to provide sufficient information - * to edit the character content of the original XML document. - * For example, when lines contain combining character sequences, wide - * characters, surrogate pairs, or bi-directional text, the value may - * not correspond to the column in a text editor's display.

+ * is intended only as an approximation for the sake of error + * reporting; it is not intended to provide sufficient information + * to edit the character content of the original XML document.

* *

The return value is an approximation of the column number * in the document entity or external parsed entity where the * markup triggering the event appears.

+ * + *

If possible, the SAX driver should provide the line position + * of the first character after the text associated with the document + * event.

* *

If possible, the SAX driver should provide the line position * of the first character after the text associated with the document 1.2.2.1 +4 -6 xml-commons/java/external/src/org/xml/sax/Parser.java Index: Parser.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/Parser.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Parser.java 27 Feb 2002 16:04:17 -0000 1.2 +++ Parser.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX parser interface. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: Parser.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: Parser.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -15,8 +14,6 @@ *

* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This was the main event supplier interface for SAX1; it has @@ -40,8 +37,9 @@ * {@link org.xml.sax.XMLReader XMLReader} * interface, which includes Namespace support. * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.EntityResolver * @see org.xml.sax.DTDHandler * @see org.xml.sax.DocumentHandler 1.2.2.1 +7 -16 xml-commons/java/external/src/org/xml/sax/SAXException.java Index: SAXException.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/SAXException.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- SAXException.java 27 Feb 2002 16:04:17 -0000 1.2 +++ SAXException.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX exception class. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: SAXException.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: SAXException.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -11,8 +10,6 @@ *

* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

This class can contain basic error or warning information from @@ -30,27 +27,19 @@ * {@link org.xml.sax.SAXParseException SAXParseException} subclass.

* * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.SAXParseException */ public class SAXException extends Exception { - - - /** - * Create a new SAXException. - */ - public SAXException () - { - super(); - this.exception = null; - } /** * Create a new SAXException. * * @param message The error or warning message. + * @see org.xml.sax.Parser#setLocale */ public SAXException (String message) { super(message); @@ -82,6 +71,7 @@ * * @param message The detail message. * @param e The exception to be wrapped in a SAXException. + * @see org.xml.sax.Parser#setLocale */ public SAXException (String message, Exception e) { @@ -98,6 +88,7 @@ * the detail message from the embedded exception.

* * @return The error or warning message. + * @see org.xml.sax.Parser#setLocale */ public String getMessage () { 1.2.2.1 +5 -16 xml-commons/java/external/src/org/xml/sax/SAXNotRecognizedException.java Index: SAXNotRecognizedException.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/SAXNotRecognizedException.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- SAXNotRecognizedException.java 27 Feb 2002 16:04:17 -0000 1.2 +++ SAXNotRecognizedException.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // SAXNotRecognizedException.java - unrecognized feature or value. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the Public Domain. -// $Id: SAXNotRecognizedException.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: SAXNotRecognizedException.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -15,8 +14,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

An XMLReader will throw this exception when it finds an @@ -24,21 +21,13 @@ * extensions may use this class for other, similar purposes.

* * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.SAXNotSupportedException */ public class SAXNotRecognizedException extends SAXException { - - /** - * Default constructor. - */ - public SAXNotRecognizedException () - { - super(); - } - /** * Construct a new exception with the given message. 1.2.2.1 +5 -16 xml-commons/java/external/src/org/xml/sax/SAXNotSupportedException.java Index: SAXNotSupportedException.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/SAXNotSupportedException.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- SAXNotSupportedException.java 27 Feb 2002 16:04:17 -0000 1.2 +++ SAXNotSupportedException.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // SAXNotSupportedException.java - unsupported feature or value. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the Public Domain. -// $Id: SAXNotSupportedException.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: SAXNotSupportedException.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -14,8 +13,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

An XMLReader will throw this exception when it recognizes a @@ -24,21 +21,13 @@ * extensions may use this class for similar purposes.

* * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.SAXNotRecognizedException */ public class SAXNotSupportedException extends SAXException { - - /** - * Construct a new exception with no message. - */ - public SAXNotSupportedException () - { - super(); - } - /** * Construct a new exception with the given message. 1.2.2.1 +15 -21 xml-commons/java/external/src/org/xml/sax/SAXParseException.java Index: SAXParseException.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/SAXParseException.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- SAXParseException.java 27 Feb 2002 16:04:17 -0000 1.2 +++ SAXParseException.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX exception class. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: SAXParseException.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: SAXParseException.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -11,13 +10,10 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* - *

This exception may include information for locating the error - * in the original XML document, as if it came from a {@link Locator} - * object. Note that although the application + *

This exception will include information for locating the error + * in the original XML document. Note that although the application * will receive a SAXParseException as the argument to the handlers * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface, * the application is not actually required to throw the exception; @@ -28,8 +24,9 @@ * SAXException}, it inherits the ability to wrap another exception.

* * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.SAXException * @see org.xml.sax.Locator * @see org.xml.sax.ErrorHandler @@ -53,6 +50,7 @@ * @param locator The locator object for the error or warning (may be * null). * @see org.xml.sax.Locator + * @see org.xml.sax.Parser#setLocale */ public SAXParseException (String message, Locator locator) { super(message); @@ -79,6 +77,7 @@ * null). * @param e Any exception. * @see org.xml.sax.Locator + * @see org.xml.sax.Parser#setLocale */ public SAXParseException (String message, Locator locator, Exception e) { @@ -97,11 +96,8 @@ * *

This constructor is most useful for parser writers.

* - *

All parameters except the message are as if - * they were provided by a {@link Locator}. For example, if the - * system identifier is a URL (including relative filename), the - * caller must resolve it fully before creating the exception.

- * + *

If the system identifier is a URL, the parser must resolve it + * fully before creating the exception.

* * @param message The error or warning message. * @param publicId The public identifer of the entity that generated @@ -112,6 +108,7 @@ * caused the error or warning. * @param columnNumber The column number of the end of the text that * cause the error or warning. + * @see org.xml.sax.Parser#setLocale */ public SAXParseException (String message, String publicId, String systemId, int lineNumber, int columnNumber) @@ -128,10 +125,8 @@ * need to wrap an exception that is not a subclass of * {@link org.xml.sax.SAXException SAXException}.

* - *

All parameters except the message and exception are as if - * they were provided by a {@link Locator}. For example, if the - * system identifier is a URL (including relative filename), the - * caller must resolve it fully before creating the exception.

+ *

If the system identifier is a URL, the parser must resolve it + * fully before creating the exception.

* * @param message The error or warning message, or null to use * the message from the embedded exception. @@ -144,6 +139,7 @@ * @param columnNumber The column number of the end of the text that * cause the error or warning. * @param e Another exception to embed in this one. + * @see org.xml.sax.Parser#setLocale */ public SAXParseException (String message, String publicId, String systemId, int lineNumber, int columnNumber, Exception e) @@ -189,7 +185,7 @@ /** * Get the system identifier of the entity where the exception occurred. * - *

If the system identifier is a URL, it will have been resolved + *

If the system identifier is a URL, it will be resolved * fully.

* * @return A string containing the system identifier, or null @@ -204,8 +200,6 @@ /** * The line number of the end of the text where the exception occurred. - * - *

The first line is line 1.

* * @return An integer representing the line number, or -1 * if none is available. 1.2.2.1 +5 -7 xml-commons/java/external/src/org/xml/sax/XMLFilter.java Index: XMLFilter.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/XMLFilter.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- XMLFilter.java 27 Feb 2002 16:04:17 -0000 1.2 +++ XMLFilter.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // XMLFilter.java - filter SAX2 events. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the Public Domain. -// $Id: XMLFilter.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: XMLFilter.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -15,8 +14,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

An XML filter is like an XML reader, except that it obtains its @@ -31,8 +28,9 @@ * ErrorHandler} events automatically.

* * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.helpers.XMLFilterImpl */ public interface XMLFilter extends XMLReader 1.2.2.1 +59 -42 xml-commons/java/external/src/org/xml/sax/XMLReader.java Index: XMLReader.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/XMLReader.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- XMLReader.java 27 Feb 2002 16:04:17 -0000 1.2 +++ XMLReader.java 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // XMLReader.java - read an XML document. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the Public Domain. -// $Id: XMLReader.java,v 1.2 2002/02/27 16:04:17 dims Exp $ +// $Id: XMLReader.java,v 1.2.2.1 2002/05/10 20:42:38 sboag Exp $ package org.xml.sax; @@ -16,8 +15,6 @@ *
* This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
* *

Note: despite its name, this interface does @@ -39,7 +36,7 @@ *

This interface replaces the (now deprecated) SAX 1.0 {@link * org.xml.sax.Parser Parser} interface. The XMLReader interface * contains two important enhancements over the old Parser - * interface (as well as some minor ones):

+ * interface:

* *
    *
  1. it adds a standard way to query and set features and @@ -52,8 +49,9 @@ * a SAX2 XMLReader and vice-versa.

    * * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.XMLFilter * @see org.xml.sax.helpers.ParserAdapter * @see org.xml.sax.helpers.XMLReaderAdapter @@ -68,23 +66,22 @@ /** - * Look up the value of a feature flag. + * Look up the value of a feature. * *

    The feature name is any fully-qualified URI. It is * possible for an XMLReader to recognize a feature name but - * temporarily be unable to return its value. - * Some feature values may be available only in specific - * contexts, such as before, during, or after a parse. - * Also, some feature values may not be programmatically accessible. - * (In the case of an adapter for SAX1 {@link Parser}, there is no - * implementation-independent way to expose whether the underlying - * parser is performing validation, expanding external entities, - * and so forth.)

    + * to be unable to return its value; this is especially true + * in the case of an adapter for a SAX1 Parser, which has + * no way of knowing whether the underlying parser is + * performing validation or expanding external entities.

    * *

    All XMLReaders are required to recognize the * http://xml.org/sax/features/namespaces and the * http://xml.org/sax/features/namespace-prefixes feature names.

    * + *

    Some feature values may be available only in specific + * contexts, such as before, during, or after a parse.

    + * *

    Typical usage is something like this:

    * *
      @@ -115,9 +112,9 @@
            * using names built on their own URIs.

    * * @param name The feature name, which is a fully-qualified URI. - * @return The current value of the feature (true or false). - * @exception org.xml.sax.SAXNotRecognizedException If the feature - * value can't be assigned or retrieved. + * @return The current state of the feature (true or false). + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the feature name but * cannot determine its value at this time. @@ -128,23 +125,27 @@ /** - * Set the value of a feature flag. + * Set the state of a feature. * *

    The feature name is any fully-qualified URI. It is - * possible for an XMLReader to expose a feature value but - * to be unable to change the current value. - * Some feature values may be immutable or mutable only - * in specific contexts, such as before, during, or after - * a parse.

    + * possible for an XMLReader to recognize a feature name but + * to be unable to set its value; this is especially true + * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser Parser}, + * which has no way of affecting whether the underlying parser is + * validating, for example.

    * *

    All XMLReaders are required to support setting * http://xml.org/sax/features/namespaces to true and * http://xml.org/sax/features/namespace-prefixes to false.

    * + *

    Some feature values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.

    + * * @param name The feature name, which is a fully-qualified URI. - * @param value The requested value of the feature (true or false). - * @exception org.xml.sax.SAXNotRecognizedException If the feature - * value can't be assigned or retrieved. + * @param state The requested state of the feature (true or false). + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the feature name but * cannot set the requested value. @@ -159,21 +160,24 @@ * *

    The property name is any fully-qualified URI. It is * possible for an XMLReader to recognize a property name but - * temporarily be unable to return its value. - * Some property values may be available only in specific - * contexts, such as before, during, or after a parse.

    + * to be unable to return its state; this is especially true + * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser + * Parser}.

    * *

    XMLReaders are not required to recognize any specific * property names, though an initial core set is documented for * SAX2.

    * + *

    Some property values may be available only in specific + * contexts, such as before, during, or after a parse.

    + * *

    Implementors are free (and encouraged) to invent their own properties, * using names built on their own URIs.

    * * @param name The property name, which is a fully-qualified URI. * @return The current value of the property. - * @exception org.xml.sax.SAXNotRecognizedException If the property - * value can't be assigned or retrieved. + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the property name. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the property name but * cannot determine its value at this time. @@ -188,22 +192,25 @@ * *

    The property name is any fully-qualified URI. It is * possible for an XMLReader to recognize a property name but - * to be unable to change the current value. - * Some property values may be immutable or mutable only - * in specific contexts, such as before, during, or after - * a parse.

    + * to be unable to set its value; this is especially true + * in the case of an adapter for a SAX1 {@link org.xml.sax.Parser + * Parser}.

    * *

    XMLReaders are not required to recognize setting - * any specific property names, though a core set is defined by + * any specific property names, though a core set is provided with * SAX2.

    * + *

    Some property values may be immutable or mutable only + * in specific contexts, such as before, during, or after + * a parse.

    + * *

    This method is also the standard mechanism for setting * extended handlers.

    * * @param name The property name, which is a fully-qualified URI. - * @param value The requested value for the property. - * @exception org.xml.sax.SAXNotRecognizedException If the property - * value can't be assigned or retrieved. + * @param state The requested value for the property. + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the property name. * @exception org.xml.sax.SAXNotSupportedException When the * XMLReader recognizes the property name but * cannot set the requested value. @@ -229,6 +236,8 @@ * resolver immediately.

    * * @param resolver The entity resolver. + * @exception java.lang.NullPointerException If the resolver + * argument is null. * @see #getEntityResolver */ public void setEntityResolver (EntityResolver resolver); @@ -255,6 +264,8 @@ * handler immediately.

    * * @param handler The DTD handler. + * @exception java.lang.NullPointerException If the handler + * argument is null. * @see #getDTDHandler */ public void setDTDHandler (DTDHandler handler); @@ -282,6 +293,8 @@ * handler immediately.

    * * @param handler The content handler. + * @exception java.lang.NullPointerException If the handler + * argument is null. * @see #getContentHandler */ public void setContentHandler (ContentHandler handler); @@ -311,6 +324,8 @@ * handler immediately.

    * * @param handler The error handler. + * @exception java.lang.NullPointerException If the handler + * argument is null. * @see #getErrorHandler */ public void setErrorHandler (ErrorHandler handler); @@ -396,3 +411,5 @@ throws IOException, SAXException; } + +// end of XMLReader.java 1.2.2.1 +80 -161 xml-commons/java/external/src/org/xml/sax/package.html Index: package.html =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/package.html,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- package.html 27 Feb 2002 16:04:17 -0000 1.2 +++ package.html 10 May 2002 20:42:38 -0000 1.2.2.1 @@ -1,164 +1,83 @@ - - - - - - -

    This package provides the core SAX APIs. -Some SAX1 APIs are deprecated to encourage integration of -namespace-awareness into designs of new applications -and into maintainance of existing infrastructure.

    - -

    See http://www.saxproject.org -for more information about SAX.

    - - -

    SAX2 Standard Feature Flags

    - -

    One of the essential characteristics of SAX2 is that it added -feature flags which can be used to examine and perhaps modify -parser modes, in particular modes such as validation. -Since features are identified by (absolute) URIs, anyone -can define such features. -Currently defined standard feature URIs have the prefix -http://xml.org/sax/features/ before an identifier such as -validation. Turn features on or off using -setFeature. Those standard identifiers are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Feature IDDefaultDescription
    external-general-entitiesunspecified Reports whether this parser processes external - general entities; always true if validating
    external-parameter-entitiesunspecified Reports whether this parser processes external - parameter entities; always true if validating
    lexical-handler/parameter-entitiesunspecified true indicates that the LexicalHandler will report the - beginning and end of parameter entities -
    namespacestrue true indicates namespace URIs and unprefixed local names - for element and attribute names will be available
    namespace-prefixesfalse true indicates XML 1.0 names (with prefixes) and attributes - (including xmlns* attributes) will be available
    string-interningunspecified true if all XML names (for elements, prefixes, attributes, - entities, notations, and local names), - as well as Namespace URIs, will have been interned - using java.lang.String.intern. This supports fast - testing of equality/inequality against string constants.
    validationunspecified controls whether the parser is reporting all validity - errors; if true, all external entities will be read.
    - -

    Support for the default values of the -namespaces and namespace-prefixes -properties is required. + + + + + +Simple API for XML + + +

    Simple API for XML (SAX)

    +

    About

    +

    +SAX is the Simple API for XML, originally a Java-only API. SAX was +the first widely adopted API for XML in Java, and is a "de facto" +standard. The current version is SAX 2.0, and there are versions +for several programming language environments other than Java.

    - -

    For default values not specified by SAX2, -each XMLReader implementation specifies its default, -or may choose not to expose the feature flag. -Unless otherwise specified here, -implementations may support changing current values -of these standard feature flags, but not while parsing. +

    Copyright Status

    +

    +SAX is free!

    - -

    SAX2 Standard Handler and Property IDs

    - -

    For parser interface characteristics that are described -as objects, a separate namespace is defined. The -objects in this namespace are again identified by URI, and -the standard property URIs have the prefix -http://xml.org/sax/properties/ before an identifier such as -lexical-handler or -dom-node. Manage those properties using -setProperty(). Those identifiers are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Property IDDescription
    declaration-handler Used to see most DTD declarations except those treated - as lexical ("document element name is ...") or which are - mandatory for all SAX parsers (DTDHandler). - The Object must implement org.xml.sax.ext.DeclHandler. -
    dom-node For "DOM Walker" style parsers, which ignore their - parser.parse() parameters, this is used to - specify the DOM (sub)tree being walked by the parser. - The Object must implement the - org.w3c.dom.Node interface. -
    lexical-handler Used to see some syntax events that are essential in some - applications: comments, CDATA delimeters, selected general - entity inclusions, and the start and end of the DTD - (and declaration of document element name). - The Object must implement org.xml.sax.ext.LexicalHandler. -
    xml-string Readable only during a parser callback, this exposes a TBS - chunk of characters responsible for the current event.
    - -

    All of these standard properties are optional; -XMLReader implementations need not support them. +

    +In fact, it's not possible to own a license to SAX, since it's +been placed in the public domain.

    - - +

    No Warranty

    +

    +Because SAX is released to the public domain, there is no warranty +for the design or for the software implementation, to the extent +permitted by applicable law. Except when otherwise stated in +writing the copyright holders and/or other parties provide SAX "as +is" without warranty of any kind, either expressed or implied, +including, but not limited to, the implied warranties of +merchantability and fitness for a particular purpose. The entire +risk as to the quality and performance of SAX is with you. Should +SAX prove defective, you assume the cost of all necessary servicing, +repair or correction. +

    +

    +In no event unless required by applicable law or agreed to in +writing will any copyright holder, or any other party who may +modify and/or redistribute SAX, be liable to you for damages, +including any general, special, incidental or consequential +damages arising out of the use or inability to use SAX (including +but not limited to loss of data or data being rendered inaccurate +or losses sustained by you or third parties or a failure of the +SAX to operate with any other programs), even if such holder or +other party has been advised of the possibility of such damages. +

    +

    Copyright Disclaimers

    +

    +This page includes statements to that effect by David Megginson, +who would have been able to claim copyright for the original work. +

    +

    SAX 1.0

    +

    +Version 1.0 of the Simple API for XML (SAX), created collectively +by the membership of the XML-DEV mailing list, is hereby released +into the public domain. +

    +

    +No one owns SAX: you may use it freely in both commercial and +non-commercial applications, bundle it with your software +distribution, include it on a CD-ROM, list the source code in a +book, mirror the documentation at your own web site, or use it in +any other way you see fit. +

    +

    +David Megginson, sax@megginson.com
    1998-05-11
    +

    +

    SAX 2.0

    +

    +I hereby abandon any property rights to SAX 2.0 (the Simple API +for XML), and release all of the SAX 2.0 source code, compiled +code, and documentation contained in this distribution into the +Public Domain. SAX comes with NO WARRANTY or guarantee of fitness +for any purpose. +

    +

    +David Megginson, david@megginson.com
    2000-05-05
    +

    + + No revision No revision 1.2.2.1 +18 -20 xml-commons/java/external/src/org/xml/sax/ext/DeclHandler.java Index: DeclHandler.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/ext/DeclHandler.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- DeclHandler.java 27 Feb 2002 16:04:18 -0000 1.2 +++ DeclHandler.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // DeclHandler.java - Optional handler for DTD declaration events. -// http://www.saxproject.org // Public Domain: no warranty. -// $Id: DeclHandler.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: DeclHandler.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.ext; @@ -14,14 +13,12 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * - *

    This is an optional extension handler for SAX2 to provide more - * complete information about DTD declarations in an XML document. - * XML readers are not required to recognize this handler, and it - * is not part of core-only SAX2 distributions.

    + *

    This is an optional extension handler for SAX2 to provide + * information about DTD declarations in an XML document. XML + * readers are not required to support this handler, and this + * handler is not included in the core SAX2 distribution.

    * *

    Note that data-related DTD declarations (unparsed entities and * notations) are already reported through the {@link @@ -34,16 +31,18 @@ * *

    To set the DeclHandler for an XML reader, use the * {@link org.xml.sax.XMLReader#setProperty setProperty} method - * with the property name - * http://xml.org/sax/properties/declaration-handler - * and an object implementing this interface (or null) as the value. - * If the reader does not report declaration events, it will throw a + * with the propertyId "http://xml.org/sax/properties/declaration-handler". + * If the reader does not support declaration events, it will throw a * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException} + * or a + * {@link org.xml.sax.SAXNotSupportedException SAXNotSupportedException} * when you attempt to register the handler.

    * - * @since SAX 2.0 (extensions 1.0) - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @since 1.0 + * @author David Megginson, + * sax@megginson.com + * @version 1.0 + * @see org.xml.sax.XMLReader */ public interface DeclHandler { @@ -79,14 +78,13 @@ * "NOTATION" followed by a space followed by a parenthesized * token group with all whitespace removed.

    * - *

    The value will be the value as reported to applications, - * appropriately normalized and with entity and character - * references expanded.

    + *

    Any parameter entities in the attribute value will be + * expanded, but general entities will not.

    * * @param eName The name of the associated element. * @param aName The name of the attribute. * @param type A string representing the attribute type. - * @param mode A string representing the attribute defaulting mode + * @param valueDefault A string representing the attribute default * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if * none of these applies. * @param value A string representing the attribute's default value, @@ -96,7 +94,7 @@ public abstract void attributeDecl (String eName, String aName, String type, - String mode, + String valueDefault, String value) throws SAXException; 1.2.2.1 +16 -17 xml-commons/java/external/src/org/xml/sax/ext/LexicalHandler.java Index: LexicalHandler.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/ext/LexicalHandler.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- LexicalHandler.java 27 Feb 2002 16:04:18 -0000 1.2 +++ LexicalHandler.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // LexicalHandler.java - optional handler for lexical parse events. -// http://www.saxproject.org // Public Domain: no warranty. -// $Id: LexicalHandler.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: LexicalHandler.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.ext; @@ -13,15 +12,13 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This is an optional extension handler for SAX2 to provide * lexical information about an XML document, such as comments - * and CDATA section boundaries. - * XML readers are not required to recognize this handler, and it - * is not part of core-only SAX2 distributions.

    + * and CDATA section boundaries; XML readers are not required to + * support this handler, and it is not part of the core SAX2 + * distribution.

    * *

    The events in the lexical handler apply to the entire document, * not just to the document element, and all lexical handler events @@ -30,16 +27,20 @@ * *

    To set the LexicalHandler for an XML reader, use the * {@link org.xml.sax.XMLReader#setProperty setProperty} method - * with the property name - * http://xml.org/sax/properties/lexical-handler - * and an object implementing this interface (or null) as the value. - * If the reader does not report lexical events, it will throw a + * with the propertyId "http://xml.org/sax/properties/lexical-handler". + * If the reader does not support lexical events, it will throw a * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException} + * or a + * {@link org.xml.sax.SAXNotSupportedException SAXNotSupportedException} * when you attempt to register the handler.

    * - * @since SAX 2.0 (extensions 1.0) - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @since 1.0 + * @author David Megginson, + * sax@megginson.com + * @version 1.0 + * @see org.xml.sax.XMLReader#setProperty + * @see org.xml.sax.SAXNotRecognizedException + * @see org.xml.sax.SAXNotSupportedException */ public interface LexicalHandler { @@ -75,8 +76,6 @@ * external DTD subset, or null if none was declared. * @param systemId The declared system identifier for the * external DTD subset, or null if none was declared. - * (Note that this is not resolved against the document - * base URI.) * @exception SAXException The application may raise an * exception. * @see #endDTD @@ -106,7 +105,7 @@ * *

    The reporting of parameter entities (including * the external DTD subset) is optional, and SAX2 drivers that - * report LexicalHandler events may not implement it; you can use the + * support LexicalHandler may not support it; you can use the * http://xml.org/sax/features/lexical-handler/parameter-entities * feature to query or control the reporting of parameter entities.

    1.2.2.1 +88 -29 xml-commons/java/external/src/org/xml/sax/ext/package.html Index: package.html =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/ext/package.html,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- package.html 27 Feb 2002 16:04:18 -0000 1.2 +++ package.html 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,49 +1,108 @@ - + + + + + +SAX2 is Free! + + + +

    This package, SAX2-ext, is an extension package for SAX2. It is +designed both to allow SAX drivers to pass certain types of none-core +information to applications and to serve as a simple model for other +SAX2 extension packages.

    - +

    NOTE: this package alone does add any +functionality; it simply provides optional interfaces for SAX2 drivers +to use. You must find a SAX2 driver that supports these interfaces if +you actually want to have access to lexical and declaration +information.

    + +

    The SAX2-ext package currently contains two extension handlers for +SAX2:

    + +
      -

      -This package contains interfaces to optional SAX2 handlers. +

    1. LexicalHandler, which reports comments, the DOCTYPE declaration, +CDATA sections, and (some) entity boundaries; and
    2. -

      See http://www.saxproject.org -for more information about SAX.

      +
    3. DeclHandler, which reports element, attribute, and entity +declarations.
    4. -

      -The package is independent of the SAX2 core, though the functionality -exposed generally needs to be implemented within a parser. -That independence has several consequences:

      +
    + +

    This package is independent of the SAX2 core, and that independence +has several consequences:

      -
    • SAX2 drivers are not required to recognize these handlers, -and you cannot assume that the class files will be present in every SAX2 +
    • SAX2 drivers are not required to support these handlers, +and you cannot assume that the classes will be present in every SAX2 installation.
    • This package may be updated independently of SAX2 (i.e. new handlers may be added without updating SAX2 itself).
    • -
    • The handlers are not implemented by the SAX2 -org.xml.sax.helpers.DefaultHandler or -org.xml.sax.helpers.XMLFilterImpl classes. -You can subclass these if you need such behaviour.
    • +
    • The handlers are not supported explicitly by the SAX2 +XMLFilter interface (i.e. events are not passed on by +default); you can subclass XMLFilter if you need such behaviour.
    • The handlers need to be registered differently than regular SAX2 handlers.
    -

    This package, SAX2-ext, is a standardized extension to SAX2. It is -designed both to allow SAX parsers to pass certain types of information -to applications, and to serve as a simple model for other SAX2 parser -extension packages. Not all such extension packages should need to -be recognized directly by parsers, however. -As an example, most schema systems can be cleanly layered on top -of parsers supporting the standardized SAX2 interfaces.

    +

    To set a LexicalHandler, for example, you need to do something like +this:

    -

    NOTE: this package alone does add any -functionality; it simply provides optional interfaces for SAX2 drivers -to use. You must use a SAX2 driver that recognizes these interfaces if -you actually want to have access to lexical and declaration -information.

    +
      +LexicalHandler lh = new MyLexicalHandler();
      +try {
      +  xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler",
      +                        lh);
      +} catch (SAXException e) {
      +  System.out.println("LexicalHandler not supported by this SAX2 driver.");
      +}
      +
    + + +
    +

    SAX2-ext Properties

    + +

    Here is a full definition of the two new SAX2 properties introduced +in this version of SAX2-ext:

    + +
    + +
    http://xml.org/sax/properties/lexical-handler
    +
    data type: +org.xml.sax.ext.LexicalHandler
    +
    description: An optional extension handler for +lexical events like comments.
    +
    access: read/write
    + +
    http://xml.org/sax/properties/declaration-handler
    +
    data type: +org.xml.sax.ext.DeclHandler
    +
    description: An optional extension handler for +DTD-related events other than notations and unparsed entities.
    +
    access: read/write
    + +
    + +

    SAX2 is Free!

    + +

    I hereby abandon any property rights to SAX 2.0 (the Simple API for +XML), and release all of the SAX 2.0 source code, compiled code, and +documentation contained in this distribution into the Public Domain. +SAX comes with NO WARRANTY or guarantee of fitness for any +purpose.

    + +

    David Megginson, david@megginson.com

    +

    2000-05-05

    - + + No revision No revision 1.2.2.1 +4 -6 xml-commons/java/external/src/org/xml/sax/helpers/AttributeListImpl.java Index: AttributeListImpl.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/AttributeListImpl.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- AttributeListImpl.java 27 Feb 2002 16:04:18 -0000 1.2 +++ AttributeListImpl.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX default implementation for AttributeList. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: AttributeListImpl.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: AttributeListImpl.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -16,8 +15,6 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    AttributeList implements the deprecated SAX1 {@link @@ -58,8 +55,9 @@ * {@link org.xml.sax.helpers.AttributesImpl * AttributesImpl} helper class. * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.AttributeList * @see org.xml.sax.DocumentHandler#startElement */ 1.3.2.1 +39 -53 xml-commons/java/external/src/org/xml/sax/helpers/AttributesImpl.java Index: AttributesImpl.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/AttributesImpl.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- AttributesImpl.java 27 Feb 2002 16:04:18 -0000 1.3 +++ AttributesImpl.java 10 May 2002 20:42:39 -0000 1.3.2.1 @@ -1,9 +1,8 @@ // AttributesImpl.java - default implementation of Attributes. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the public domain. -// $Id: AttributesImpl.java,v 1.3 2002/02/27 16:04:18 dims Exp $ +// $Id: AttributesImpl.java,v 1.3.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -17,8 +16,6 @@ *

    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This class provides a default implementation of the SAX2 @@ -42,8 +39,9 @@ * implementation using a single array rather than a set of Vectors.

    * * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 */ public class AttributesImpl implements Attributes { @@ -322,16 +320,12 @@ /** * Clear the attribute list for reuse. * - *

    Note that little memory is freed by this call: - * the current array is kept so it can be + *

    Note that no memory is actually freed by this call: + * the current arrays are kept so that they can be * reused.

    */ public void clear () { - if (data != null) { - for (int i = 0; i < (length * 5); i++) - data [i] = null; - } length = 0; } @@ -346,17 +340,15 @@ */ public void setAttributes (Attributes atts) { - clear(); - length = atts.getLength(); - if (length > 0) { - data = new String[length*5]; - for (int i = 0; i < length; i++) { - data[i*5] = atts.getURI(i); - data[i*5+1] = atts.getLocalName(i); - data[i*5+2] = atts.getQName(i); - data[i*5+3] = atts.getType(i); - data[i*5+4] = atts.getValue(i); - } + clear(); + length = atts.getLength(); + data = new String[length*5]; + for (int i = 0; i < length; i++) { + data[i*5] = atts.getURI(i); + data[i*5+1] = atts.getLocalName(i); + data[i*5+2] = atts.getQName(i); + data[i*5+3] = atts.getType(i); + data[i*5+4] = atts.getValue(i); } } @@ -438,16 +430,15 @@ public void removeAttribute (int index) { if (index >= 0 && index < length) { + data[index*5] = null; + data[index*5+1] = null; + data[index*5+2] = null; + data[index*5+3] = null; + data[index*5+4] = null; if (index < length - 1) { System.arraycopy(data, (index+1)*5, data, index*5, (length-index-1)*5); } - index = (length - 1) * 5; - data [index++] = null; - data [index++] = null; - data [index++] = null; - data [index++] = null; - data [index] = null; length--; } else { badIndex(index); @@ -565,29 +556,24 @@ * @param n The minimum number of attributes that the array must * be able to hold. */ - private void ensureCapacity (int n) { - if (n <= 0) { - return; - } - int max; - if (data == null || data.length == 0) { - max = 25; - } - else if (data.length >= n * 5) { - return; - } - else { - max = data.length; - } - while (max < n * 5) { - max *= 2; - } - - String newData[] = new String[max]; - if (length > 0) { - System.arraycopy(data, 0, newData, 0, length*5); - } - data = newData; + private void ensureCapacity (int n) + { + if (n > 0 && data == null) { + data = new String[25]; + } + + int max = data.length; + if (max >= n * 5) { + return; + } + + + while (max < n * 5) { + max *= 2; + } + String newData[] = new String[max]; + System.arraycopy(data, 0, newData, 0, length*5); + data = newData; } 1.2.2.1 +10 -31 xml-commons/java/external/src/org/xml/sax/helpers/DefaultHandler.java Index: DefaultHandler.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/DefaultHandler.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- DefaultHandler.java 27 Feb 2002 16:04:18 -0000 1.2 +++ DefaultHandler.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,14 +1,11 @@ // DefaultHandler.java - default implementation of the core handlers. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the public domain. -// $Id: DefaultHandler.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: DefaultHandler.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; -import java.io.IOException; - import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.Attributes; @@ -26,8 +23,6 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This class is available as a convenience base class for SAX2 @@ -50,8 +45,9 @@ * {@link org.xml.sax.HandlerBase HandlerBase} class.

    * * @since SAX 2.0 - * @author David Megginson, - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.EntityResolver * @see org.xml.sax.DTDHandler * @see org.xml.sax.ContentHandler @@ -81,14 +77,12 @@ * document. * @return The new input source, or null to require the * default behaviour. - * @exception java.io.IOException If there is an error setting - * up the new input source. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.EntityResolver#resolveEntity */ public InputSource resolveEntity (String publicId, String systemId) - throws IOException, SAXException + throws SAXException { return null; } @@ -254,17 +248,8 @@ * each element (such as allocating a new tree node or writing * output to a file).

    * - * @param uri The Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed. - * @param localName The local name (without prefix), or the - * empty string if Namespace processing is not being - * performed. - * @param qName The qualified name (with prefix), or the - * empty string if qualified names are not available. - * @param atts The attributes attached to the element. If - * there are no attributes, it shall be an empty - * Attributes object. + * @param name The element type name. + * @param attributes The specified or defaulted attributes. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement @@ -285,14 +270,8 @@ * each element (such as finalising a tree node or writing * output to a file).

    * - * @param uri The Namespace URI, or the empty string if the - * element has no Namespace URI or if Namespace - * processing is not being performed. - * @param localName The local name (without prefix), or the - * empty string if Namespace processing is not being - * performed. - * @param qName The qualified name (with prefix), or the - * empty string if qualified names are not available. + * @param name The element type name. + * @param attributes The specified or defaulted attributes. * @exception org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#endElement 1.2.2.1 +4 -6 xml-commons/java/external/src/org/xml/sax/helpers/LocatorImpl.java Index: LocatorImpl.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/LocatorImpl.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- LocatorImpl.java 27 Feb 2002 16:04:18 -0000 1.2 +++ LocatorImpl.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,7 +1,6 @@ // SAX default implementation for Locator. -// http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: LocatorImpl.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: LocatorImpl.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -14,8 +13,6 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This class is available mainly for application writers, who @@ -45,8 +42,9 @@ * requested, rather than constantly updating a Locator object.

    * * @since SAX 1.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.Locator Locator */ public class LocatorImpl implements Locator 1.2.2.1 +40 -121 xml-commons/java/external/src/org/xml/sax/helpers/NamespaceSupport.java Index: NamespaceSupport.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/NamespaceSupport.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- NamespaceSupport.java 27 Feb 2002 16:04:18 -0000 1.2 +++ NamespaceSupport.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // NamespaceSupport.java - generic Namespace support for SAX. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // This class is in the Public Domain. NO WARRANTY! -// $Id: NamespaceSupport.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: NamespaceSupport.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -14,14 +13,11 @@ /** - * Encapsulate Namespace logic for use by applications using SAX, - * or internally by SAX drivers. + * Encapsulate Namespace logic for use by SAX drivers. * *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This class encapsulates the logic of Namespace processing: @@ -43,16 +39,16 @@ * support.declarePrefix("", "http://www.w3.org/1999/xhtml"); * support.declarePrefix("dc", "http://www.purl.org/dc#"); * - * parts = support.processName("p", parts, false); + * String parts[] = support.processName("p", parts, false); * System.out.println("Namespace URI: " + parts[0]); * System.out.println("Local name: " + parts[1]); * System.out.println("Raw name: " + parts[2]); - * - * parts = support.processName("dc:title", parts, false); + + * String parts[] = support.processName("dc:title", parts, false); * System.out.println("Namespace URI: " + parts[0]); * System.out.println("Local name: " + parts[1]); * System.out.println("Raw name: " + parts[2]); - * + * support.popContext(); *

    * @@ -61,14 +57,10 @@ * prefix/URI mapping is repeated for each context (for example), this * class will be somewhat less efficient.

    * - *

    Although SAX drivers (parsers) may choose to use this class to - * implement namespace handling, they are not required to do so. - * Applications must track namespace information themselves if they - * want to use namespace information. - * * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 */ public class NamespaceSupport { @@ -80,9 +72,7 @@ /** - * The XML Namespace URI as a constant. - * The value is http://www.w3.org/XML/1998/namespace - * as defined in the XML Namespaces specification. + * The XML Namespace as a constant. * *

    This is the Namespace URI that is automatically mapped * to the "xml" prefix.

    @@ -135,45 +125,21 @@ /** * Start a new Namespace context. - * The new context will automatically inherit - * the declarations of its parent context, but it will also keep - * track of which declarations were made within this context. * - *

    Event callback code should start a new context once per element. - * This means being ready to call this in either of two places. - * For elements that don't include namespace declarations, the - * ContentHandler.startElement() callback is the right place. - * For elements with such a declaration, it'd done in the first - * ContentHandler.startPrefixMapping() callback. - * A boolean flag can be used to - * track whether a context has been started yet. When either of - * those methods is called, it checks the flag to see if a new context - * needs to be started. If so, it starts the context and sets the - * flag. After ContentHandler.startElement() - * does that, it always clears the flag. - * - *

    Normally, SAX drivers would push a new context at the beginning - * of each XML element. Then they perform a first pass over the - * attributes to process all namespace declarations, making - * ContentHandler.startPrefixMapping() callbacks. - * Then a second pass is made, to determine the namespace-qualified - * names for all attributes and for the element name. - * Finally all the information for the - * ContentHandler.startElement() callback is available, - * so it can then be made. + *

    Normally, you should push a new context at the beginning + * of each XML element: the new context will automatically inherit + * the declarations of its parent context, but it will also keep + * track of which declarations were made within this context.

    * *

    The Namespace support object always starts with a base context * already in force: in this context, only the "xml" prefix is * declared.

    * - * @see org.xml.sax.ContentHandler * @see #popContext */ public void pushContext () { int max = contexts.length; - - contexts [contextPos].declsOK = false; contextPos++; // Extend the array if necessary @@ -212,7 +178,6 @@ */ public void popContext () { - contexts[contextPos].clear(); contextPos--; if (contextPos < 0) { throw new EmptyStackException(); @@ -228,42 +193,29 @@ /** - * Declare a Namespace prefix. All prefixes must be declared - * before they are referenced. For example, a SAX driver (parser) - * would scan an element's attributes - * in two passes: first for namespace declarations, - * then a second pass using {@link #processName processName()} to - * interpret prefixes against (potentially redefined) prefixes. + * Declare a Namespace prefix. * *

    This method declares a prefix in the current Namespace * context; the prefix will remain in force until this context * is popped, unless it is shadowed in a descendant context.

    * - *

    To declare the default element Namespace, use the empty string as - * the prefix.

    + *

    To declare a default Namespace, use the empty string. The + * prefix must not be "xml" or "xmlns".

    * *

    Note that you must not declare a prefix after - * you've pushed and popped another Namespace context, or - * treated the declarations phase as complete by processing - * a prefixed name.

    - * - *

    Note that there is an asymmetry in this library: {@link - * #getPrefix getPrefix} will not return the "" prefix, - * even if you have declared a default element namespace. - * To check for a default namespace, + * you've pushed and popped another Namespace.

    + * + *

    Note that there is an asymmetry in this library: while {@link + * #getPrefix getPrefix} will not return the default "" prefix, + * even if you have declared one; to check for a default prefix, * you have to look it up explicitly using {@link #getURI getURI}. * This asymmetry exists to make it easier to look up prefixes * for attribute names, where the default prefix is not allowed.

    * - * @param prefix The prefix to declare, or the empty string to - * indicate the default element namespace. This may never have - * the value "xml" or "xmlns". + * @param prefix The prefix to declare, or null for the empty + * string. * @param uri The Namespace URI to associate with the prefix. * @return true if the prefix was legal, false otherwise - * @exception IllegalStateException when a prefix is declared - * after looking up a name in the context, or after pushing - * another context on top of it. - * * @see #processName * @see #getURI * @see #getPrefix @@ -280,8 +232,7 @@ /** - * Process a raw XML 1.0 name, after all declarations in the current - * context have been handled by {@link #declarePrefix declarePrefix()}. + * Process a raw XML 1.0 name. * *

    This method processes a raw XML 1.0 name in the current * context by removing the prefix and looking it up among the @@ -304,7 +255,7 @@ * *

    Note that attribute names are processed differently than * element names: an unprefixed element name will received the - * default Namespace (if any), while an unprefixed attribute name + * default Namespace (if any), while an unprefixed element name * will not.

    * * @param qName The raw XML 1.0 name to be processed. @@ -468,14 +419,9 @@ /** * Internal class for a single Namespace context. * - *

    This module caches and reuses Namespace contexts, - * so the number allocated + *

    This module caches and reuses Namespace contexts, so the number allocated * will be equal to the element depth of the document, not to the total - * number of elements (i.e. 5-10 rather than tens of thousands). - * Also, data structures used to represent contexts are shared when - * possible (child contexts without declarations) to further reduce - * the amount of memory that's consumed. - *

    + * number of elements (i.e. 5-10 rather than tens of thousands).

    */ final class Context { @@ -490,8 +436,6 @@ /** * (Re)set the parent of this Namespace context. - * The context must either have been freshly constructed, - * or must have been cleared. * * @param context The parent Namespace context object. */ @@ -504,24 +448,7 @@ elementNameTable = parent.elementNameTable; attributeNameTable = parent.attributeNameTable; defaultNS = parent.defaultNS; - declSeen = false; - declsOK = true; - } - - /** - * Makes associated state become collectible, - * invalidating this context. - * {@link #setParent} must be called before - * this context may be used again. - */ - void clear () - { - parent = null; - prefixTable = null; - uriTable = null; - elementNameTable = null; - attributeNameTable = null; - defaultNS = null; + tablesDirty = false; } @@ -535,10 +462,7 @@ void declarePrefix (String prefix, String uri) { // Lazy processing... - if (!declsOK) - throw new IllegalStateException ( - "can't declare any more prefixes in this context"); - if (!declSeen) { + if (!tablesDirty) { copyTables(); } if (declarations == null) { @@ -577,14 +501,11 @@ String name[]; Hashtable table; - // detect errors in call sequence - declsOK = false; - // Select the appropriate table. if (isAttribute) { - table = attributeNameTable; - } else { table = elementNameTable; + } else { + table = attributeNameTable; } // Start by looking in the cache, and @@ -596,11 +517,8 @@ } // We haven't seen this name in this - // context before. Maybe in the parent - // context, but we can't assume prefix - // bindings are the same. + // context before. name = new String[3]; - name[2] = qName.intern(); int index = qName.indexOf(':'); @@ -611,7 +529,8 @@ } else { name[0] = defaultNS; } - name[1] = name[2]; + name[1] = qName.intern(); + name[2] = name[1]; } // Prefix @@ -629,11 +548,12 @@ } name[0] = uri; name[1] = local.intern(); + name[2] = qName.intern(); } // Save in the cache for future use. - // (Could be shared with parent context...) table.put(name[2], name); + tablesDirty = true; return name; } @@ -739,7 +659,7 @@ } elementNameTable = new Hashtable(); attributeNameTable = new Hashtable(); - declSeen = true; + tablesDirty = true; } @@ -753,7 +673,6 @@ Hashtable elementNameTable; Hashtable attributeNameTable; String defaultNS = null; - boolean declsOK = true; @@ -762,7 +681,7 @@ //////////////////////////////////////////////////////////////// private Vector declarations = null; - private boolean declSeen = false; + private boolean tablesDirty = false; private Context parent = null; } } 1.1.2.1 +2 -3 xml-commons/java/external/src/org/xml/sax/helpers/NewInstance.java Index: NewInstance.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/NewInstance.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- NewInstance.java 27 Feb 2002 16:04:55 -0000 1.1 +++ NewInstance.java 10 May 2002 20:42:39 -0000 1.1.2.1 @@ -3,8 +3,7 @@ // Written by Edwin Goei, edwingo@apache.org // and by David Brownell, dbrownell@users.sourceforge.net // NO WARRANTY! This class is in the Public Domain. - -// $Id: NewInstance.java,v 1.1 2002/02/27 16:04:55 dims Exp $ +// $Id: NewInstance.java,v 1.1.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -30,7 +29,7 @@ * including versions of Java 2.

    * * @author Edwin Goei, David Brownell - * @version 2.0.1 (sax2r2) + * @version 2.0r2pre3 */ class NewInstance { 1.3.2.1 +126 -144 xml-commons/java/external/src/org/xml/sax/helpers/ParserAdapter.java Index: ParserAdapter.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/ParserAdapter.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- ParserAdapter.java 27 Feb 2002 16:04:18 -0000 1.3 +++ ParserAdapter.java 10 May 2002 20:42:39 -0000 1.3.2.1 @@ -1,15 +1,13 @@ // ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the public domain. -// $Id: ParserAdapter.java,v 1.3 2002/02/27 16:04:18 dims Exp $ +// $Id: ParserAdapter.java,v 1.3.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; import java.io.IOException; import java.util.Enumeration; -import java.util.Vector; import org.xml.sax.Parser; // deprecated import org.xml.sax.InputSource; @@ -35,8 +33,6 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This class wraps a SAX1 {@link org.xml.sax.Parser Parser} @@ -49,8 +45,9 @@ * attribute names.

    * * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.helpers.XMLReaderAdapter * @see org.xml.sax.XMLReader * @see org.xml.sax.Parser @@ -70,7 +67,7 @@ *

    Use the "org.xml.sax.parser" property to locate the * embedded SAX1 driver.

    * - * @exception SAXException If the embedded driver + * @exception org.xml.sax.SAXException If the embedded driver * cannot be instantiated or if the * org.xml.sax.parser property is not specified. */ @@ -159,37 +156,46 @@ private final static String FEATURES = "http://xml.org/sax/features/"; private final static String NAMESPACES = FEATURES + "namespaces"; private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes"; + private final static String VALIDATION = FEATURES + "validation"; + private final static String EXTERNAL_GENERAL = + FEATURES + "external-general-entities"; + private final static String EXTERNAL_PARAMETER = + FEATURES + "external-parameter-entities"; /** - * Set a feature flag for the parser. + * Set a feature for the parser. * - *

    The only features recognized are namespaces and + *

    The only features supported are namespaces and * namespace-prefixes.

    * * @param name The feature name, as a complete URI. - * @param value The requested feature value. - * @exception SAXNotRecognizedException If the feature - * can't be assigned or retrieved. - * @exception SAXNotSupportedException If the feature - * can't be assigned that value. + * @param state The requested feature state. + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * name is not known. + * @exception org.xml.sax.SAXNotSupportedException If the feature + * state is not supported. * @see org.xml.sax.XMLReader#setFeature */ - public void setFeature (String name, boolean value) + public void setFeature (String name, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(NAMESPACES)) { checkNotParsing("feature", name); - namespaces = value; + namespaces = state; if (!namespaces && !prefixes) { prefixes = true; } } else if (name.equals(NAMESPACE_PREFIXES)) { checkNotParsing("feature", name); - prefixes = value; + prefixes = state; if (!prefixes && !namespaces) { namespaces = true; } + } else if (name.equals(VALIDATION) || + name.equals(EXTERNAL_GENERAL) || + name.equals(EXTERNAL_PARAMETER)) { + throw new SAXNotSupportedException("Feature: " + name); } else { throw new SAXNotRecognizedException("Feature: " + name); } @@ -197,17 +203,17 @@ /** - * Check a parser feature flag. + * Check a parser feature. * - *

    The only features recognized are namespaces and + *

    The only features supported are namespaces and * namespace-prefixes.

    * * @param name The feature name, as a complete URI. - * @return The current feature value. - * @exception SAXNotRecognizedException If the feature - * value can't be assigned or retrieved. - * @exception SAXNotSupportedException If the - * feature is not currently readable. + * @return The current feature state. + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * name is not known. + * @exception org.xml.sax.SAXNotSupportedException If querying the + * feature state is not supported. * @see org.xml.sax.XMLReader#setFeature */ public boolean getFeature (String name) @@ -217,6 +223,10 @@ return namespaces; } else if (name.equals(NAMESPACE_PREFIXES)) { return prefixes; + } else if (name.equals(VALIDATION) || + name.equals(EXTERNAL_GENERAL) || + name.equals(EXTERNAL_PARAMETER)) { + throw new SAXNotSupportedException("Feature: " + name); } else { throw new SAXNotRecognizedException("Feature: " + name); } @@ -226,14 +236,14 @@ /** * Set a parser property. * - *

    No properties are currently recognized.

    + *

    No special properties are currently supported.

    * * @param name The property name. * @param value The property value. - * @exception SAXNotRecognizedException If the property - * value can't be assigned or retrieved. - * @exception SAXNotSupportedException If the property - * can't be assigned that value. + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * name is not known. + * @exception org.xml.sax.SAXNotSupportedException If the feature + * state is not supported. * @see org.xml.sax.XMLReader#setProperty */ public void setProperty (String name, Object value) @@ -246,14 +256,14 @@ /** * Get a parser property. * - *

    No properties are currently recognized.

    + *

    No special properties are currently supported.

    * * @param name The property name. * @return The property value. - * @exception SAXNotRecognizedException If the property - * value can't be assigned or retrieved. - * @exception SAXNotSupportedException If the property - * value is not currently readable. + * @exception org.xml.sax.SAXNotRecognizedException If the feature + * name is not known. + * @exception org.xml.sax.SAXNotSupportedException If the feature + * state is not supported. * @see org.xml.sax.XMLReader#getProperty */ public Object getProperty (String name) @@ -267,10 +277,15 @@ * Set the entity resolver. * * @param resolver The new entity resolver. + * @exception java.lang.NullPointerException If the entity resolver + * parameter is null. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setEntityResolver (EntityResolver resolver) { + if (resolver == null) { + throw new NullPointerException("Null entity resolver"); + } entityResolver = resolver; } @@ -291,10 +306,15 @@ * Set the DTD handler. * * @param resolver The new DTD handler. + * @exception java.lang.NullPointerException If the DTD handler + * parameter is null. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setDTDHandler (DTDHandler handler) { + if (handler == null) { + throw new NullPointerException("Null DTD handler"); + } dtdHandler = handler; } @@ -315,10 +335,15 @@ * Set the content handler. * * @param resolver The new content handler. + * @exception java.lang.NullPointerException If the content handler + * parameter is null. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setContentHandler (ContentHandler handler) { + if (handler == null) { + throw new NullPointerException("Null content handler"); + } contentHandler = handler; } @@ -339,10 +364,15 @@ * Set the error handler. * * @param resolver The new error handler. + * @exception java.lang.NullPointerException If the error handler + * parameter is null. * @see org.xml.sax.XMLReader#setEntityResolver */ public void setErrorHandler (ErrorHandler handler) { + if (handler == null) { + throw new NullPointerException("Null error handler"); + } errorHandler = handler; } @@ -365,7 +395,7 @@ * @param systemId The absolute URL of the document. * @exception java.io.IOException If there is a problem reading * the raw content of the document. - * @exception SAXException If there is a problem + * @exception org.xml.sax.SAXException If there is a problem * processing the document. * @see #parse(org.xml.sax.InputSource) * @see org.xml.sax.Parser#parse(java.lang.String) @@ -383,7 +413,7 @@ * @param input An input source for the document. * @exception java.io.IOException If there is a problem reading * the raw content of the document. - * @exception SAXException If there is a problem + * @exception org.xml.sax.SAXException If there is a problem * processing the document. * @see #parse(java.lang.String) * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource) @@ -412,7 +442,6 @@ /** - * Adapter implementation method; do not call. * Adapt a SAX1 document locator event. * * @param locator A document locator. @@ -428,10 +457,9 @@ /** - * Adapter implementation method; do not call. * Adapt a SAX1 start document event. * - * @exception SAXException The client may raise a + * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#startDocument */ @@ -445,10 +473,9 @@ /** - * Adapter implementation method; do not call. * Adapt a SAX1 end document event. * - * @exception SAXException The client may raise a + * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#endDocument */ @@ -462,25 +489,16 @@ /** - * Adapter implementation method; do not call. * Adapt a SAX1 startElement event. * *

    If necessary, perform Namespace processing.

    * * @param qName The qualified (prefixed) name. * @param qAtts The XML 1.0 attribute list (with qnames). - * @exception SAXException The client may raise a - * processing exception. */ public void startElement (String qName, AttributeList qAtts) throws SAXException { - // These are exceptions from the - // first pass; they should be - // ignored if there's a second pass, - // but reported otherwise. - Vector exceptions = null; - // If we're not doing Namespace // processing, dispatch this quickly. if (!namespaces) { @@ -495,103 +513,80 @@ // OK, we're doing Namespace processing. nsSupport.pushContext(); - int length = qAtts.getLength(); - - // First pass: handle NS decls - for (int i = 0; i < length; i++) { - String attQName = qAtts.getName(i); - - if (!attQName.startsWith("xmlns")) - continue; - // Could be a declaration... - String prefix; - int n = attQName.indexOf(':'); - - // xmlns=... - if (n == -1 && attQName.length () == 5) { - prefix = ""; - } else if (n != 5) { - // XML namespaces spec doesn't discuss "xmlnsf:oo" - // (and similarly named) attributes ... at most, warn - continue; - } else // xmlns:foo=... - prefix = attQName.substring(n+1); - - String value = qAtts.getValue(i); - if (!nsSupport.declarePrefix(prefix, value)) { - reportError("Illegal Namespace prefix: " + prefix); - continue; - } - if (contentHandler != null) - contentHandler.startPrefixMapping(prefix, value); - } - - // Second pass: copy all relevant - // attributes into the SAX2 AttributeList - // using updated prefix bindings + boolean seenDecl = false; atts.clear(); + + // Take a first pass and copy all + // attributes into the SAX2 attribute + // list, noting any Namespace + // declarations. + int length = qAtts.getLength(); for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i); String type = qAtts.getType(i); String value = qAtts.getValue(i); - // Declaration? + // Found a declaration... if (attQName.startsWith("xmlns")) { String prefix; int n = attQName.indexOf(':'); - - if (n == -1 && attQName.length () == 5) { + if (n == -1) { prefix = ""; - } else if (n != 5) { - // XML namespaces spec doesn't discuss "xmlnsf:oo" - // (and similarly named) attributes ... ignore - prefix = null; } else { prefix = attQName.substring(n+1); } - // Yes, decl: report or prune - if (prefix != null) { - if (prefixes) - atts.addAttribute("", "", attQName.intern(), + if (!nsSupport.declarePrefix(prefix, value)) { + reportError("Illegal Namespace prefix: " + prefix); + } + if (contentHandler != null) { + contentHandler.startPrefixMapping(prefix, value); + } + // We may still have to add this to + // the list. + if (prefixes) { + atts.addAttribute("", "", attQName.intern(), type, value); - continue; } - } + seenDecl = true; - // Not a declaration -- report - try { - String attName[] = processName(attQName, true, true); + // This isn't a declaration. + } else { + String attName[] = processName(attQName, true); atts.addAttribute(attName[0], attName[1], attName[2], type, value); - } catch (SAXException e) { - if (exceptions == null) - exceptions = new Vector(); - exceptions.addElement(e); - atts.addAttribute("", attQName, attQName, type, value); } } - // now handle the deferred exception reports - if (exceptions != null && errorHandler != null) { - for (int i = 0; i < exceptions.size(); i++) - errorHandler.error((SAXParseException) - (exceptions.elementAt(i))); + // If there was a Namespace declaration, + // we have to make a second pass just + // to be safe -- this will happen very + // rarely, possibly only once for each + // document. + if (seenDecl) { + length = atts.getLength(); + for (int i = 0; i < length; i++) { + String attQName = atts.getQName(i); + if (!attQName.startsWith("xmlns")) { + String attName[] = processName(attQName, true); + atts.setURI(i, attName[0]); + atts.setLocalName(i, attName[1]); + } + } } // OK, finally report the event. if (contentHandler != null) { - String name[] = processName(qName, false, false); + String name[] = processName(qName, false); contentHandler.startElement(name[0], name[1], name[2], atts); } } /** - * Adapter implementation method; do not call. * Adapt a SAX1 end element event. * * @param qName The qualified (prefixed) name. - * @exception SAXException The client may raise a + * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#endElement */ @@ -608,7 +603,7 @@ } // Split the name. - String names[] = processName(qName, false, false); + String names[] = processName(qName, false); if (contentHandler != null) { contentHandler.endElement(names[0], names[1], names[2]); Enumeration prefixes = nsSupport.getDeclaredPrefixes(); @@ -622,13 +617,12 @@ /** - * Adapter implementation method; do not call. * Adapt a SAX1 characters event. * * @param ch An array of characters. * @param start The starting position in the array. * @param length The number of characters to use. - * @exception SAXException The client may raise a + * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#characters */ @@ -642,13 +636,12 @@ /** - * Adapter implementation method; do not call. * Adapt a SAX1 ignorable whitespace event. * * @param ch An array of characters. * @param start The starting position in the array. * @param length The number of characters to use. - * @exception SAXException The client may raise a + * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#ignorableWhitespace */ @@ -662,12 +655,11 @@ /** - * Adapter implementation method; do not call. * Adapt a SAX1 processing instruction event. * * @param target The processing instruction target. * @param data The remainder of the processing instruction - * @exception SAXException The client may raise a + * @exception org.xml.sax.SAXException The client may raise a * processing exception. * @see org.xml.sax.DocumentHandler#processingInstruction */ @@ -717,22 +709,18 @@ * @param qName The qualified (prefixed) name. * @param isAttribute true if this is an attribute name. * @return The name split into three parts. - * @exception SAXException The client may throw + * @exception org.xml.sax.SAXException The client may throw * an exception if there is an error callback. */ - private String [] processName (String qName, boolean isAttribute, - boolean useException) + private String [] processName (String qName, boolean isAttribute) throws SAXException { String parts[] = nsSupport.processName(qName, nameParts, isAttribute); if (parts == null) { - if (useException) - throw makeException("Undeclared prefix: " + qName); - reportError("Undeclared prefix: " + qName); parts = new String[3]; - parts[0] = parts[1] = ""; parts[2] = qName.intern(); + reportError("Undeclared prefix: " + qName); } return parts; } @@ -742,29 +730,23 @@ * Report a non-fatal error. * * @param message The error message. - * @exception SAXException The client may throw + * @exception org.xml.sax.SAXException The client may throw * an exception. */ void reportError (String message) throws SAXException { - if (errorHandler != null) - errorHandler.error(makeException(message)); - } + if (errorHandler == null) { + return; + } - - /** - * Construct an exception for the current context. - * - * @param message The error message. - */ - private SAXParseException makeException (String message) - { + SAXParseException e; if (locator != null) { - return new SAXParseException(message, locator); + e = new SAXParseException(message, locator); } else { - return new SAXParseException(message, null, null, -1, -1); + e = new SAXParseException(message, null, null, -1, -1); } + errorHandler.error(e); } @@ -776,7 +758,7 @@ * * @param type The type of thing (feature or property). * @param name The feature or property name. - * @exception SAXNotSupportedException If a + * @exception org.xml.sax.SAXNotSupportedException If a * document is currently being parsed. */ private void checkNotParsing (String type, String name) 1.2.2.1 +2 -2 xml-commons/java/external/src/org/xml/sax/helpers/ParserFactory.java Index: ParserFactory.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/ParserFactory.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- ParserFactory.java 27 Feb 2002 16:04:18 -0000 1.2 +++ ParserFactory.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,7 +1,7 @@ // SAX parser factory. // http://www.saxproject.org // No warranty; no copyright -- use this as you will. -// $Id: ParserFactory.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: ParserFactory.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -44,7 +44,7 @@ * interface. * @since SAX 1.0 * @author David Megginson - * @version 2.0.1 (sax2r2) + * @version 2.0r2pre3 */ public class ParserFactory { 1.2.2.1 +90 -35 xml-commons/java/external/src/org/xml/sax/helpers/XMLFilterImpl.java Index: XMLFilterImpl.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/XMLFilterImpl.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- XMLFilterImpl.java 27 Feb 2002 16:04:18 -0000 1.2 +++ XMLFilterImpl.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // XMLFilterImpl.java - base SAX2 filter implementation. -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the Public Domain. -// $Id: XMLFilterImpl.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: XMLFilterImpl.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -30,8 +29,6 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This class is designed to sit between an {@link org.xml.sax.XMLReader @@ -42,8 +39,9 @@ * requests as they pass through.

    * * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.XMLFilter * @see org.xml.sax.XMLReader * @see org.xml.sax.EntityResolver @@ -66,12 +64,10 @@ * *

    This filter will have no parent: you must assign a parent * before you start a parse or do any configuration with - * setFeature or setProperty, unless you use this as a pure event - * consumer rather than as an {@link XMLReader}.

    + * setFeature or setProperty.

    * * @see org.xml.sax.XMLReader#setFeature * @see org.xml.sax.XMLReader#setProperty - * @see #setParent */ public XMLFilterImpl () { @@ -109,10 +105,14 @@ * or to set or get a feature or property will fail.

    * * @param parent The parent XML reader. + * @exception java.lang.NullPointerException If the parent is null. * @see #getParent */ public void setParent (XMLReader parent) { + if (parent == null) { + throw new NullPointerException("Null parent"); + } this.parent = parent; } @@ -136,23 +136,24 @@ /** - * Set the value of a feature. + * Set the state of a feature. * *

    This will always fail if the parent is null.

    * * @param name The feature name. - * @param value The requested feature value. - * @exception org.xml.sax.SAXNotRecognizedException If the feature - * value can't be assigned or retrieved from the parent. + * @param state The requested feature state. + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the feature name but + * XMLReader recognizes the feature name but * cannot set the requested value. + * @see org.xml.sax.XMLReader#setFeature */ - public void setFeature (String name, boolean value) + public void setFeature (String name, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { - parent.setFeature(name, value); + parent.setFeature(name, state); } else { throw new SAXNotRecognizedException("Feature: " + name); } @@ -160,17 +161,18 @@ /** - * Look up the value of a feature. + * Look up the state of a feature. * *

    This will always fail if the parent is null.

    * * @param name The feature name. - * @return The current value of the feature. - * @exception org.xml.sax.SAXNotRecognizedException If the feature - * value can't be assigned or retrieved from the parent. + * @return The current state of the feature. + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the feature name but - * cannot determine its value at this time. + * XMLReader recognizes the feature name but + * cannot determine its state at this time. + * @see org.xml.sax.XMLReader#getFeature */ public boolean getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException @@ -189,12 +191,13 @@ *

    This will always fail if the parent is null.

    * * @param name The property name. - * @param value The requested property value. - * @exception org.xml.sax.SAXNotRecognizedException If the property - * value can't be assigned or retrieved from the parent. + * @param state The requested property value. + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the property name. * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the property name but + * XMLReader recognizes the property name but * cannot set the requested value. + * @see org.xml.sax.XMLReader#setProperty */ public void setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException @@ -212,11 +215,12 @@ * * @param name The property name. * @return The current value of the property. - * @exception org.xml.sax.SAXNotRecognizedException If the property - * value can't be assigned or retrieved from the parent. + * @exception org.xml.sax.SAXNotRecognizedException When the + * XMLReader does not recognize the feature name. * @exception org.xml.sax.SAXNotSupportedException When the - * parent recognizes the property name but + * XMLReader recognizes the property name but * cannot determine its value at this time. + * @see org.xml.sax.XMLReader#setFeature */ public Object getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException @@ -233,10 +237,17 @@ * Set the entity resolver. * * @param resolver The new entity resolver. + * @exception java.lang.NullPointerException If the resolver + * is null. + * @see org.xml.sax.XMLReader#setEntityResolver */ public void setEntityResolver (EntityResolver resolver) { - entityResolver = resolver; + if (resolver == null) { + throw new NullPointerException("Null entity resolver"); + } else { + entityResolver = resolver; + } } @@ -244,6 +255,7 @@ * Get the current entity resolver. * * @return The current entity resolver, or null if none was set. + * @see org.xml.sax.XMLReader#getEntityResolver */ public EntityResolver getEntityResolver () { @@ -255,10 +267,17 @@ * Set the DTD event handler. * * @param resolver The new DTD handler. + * @exception java.lang.NullPointerException If the handler + * is null. + * @see org.xml.sax.XMLReader#setDTDHandler */ public void setDTDHandler (DTDHandler handler) { - dtdHandler = handler; + if (handler == null) { + throw new NullPointerException("Null DTD handler"); + } else { + dtdHandler = handler; + } } @@ -266,6 +285,7 @@ * Get the current DTD event handler. * * @return The current DTD handler, or null if none was set. + * @see org.xml.sax.XMLReader#getDTDHandler */ public DTDHandler getDTDHandler () { @@ -277,10 +297,17 @@ * Set the content event handler. * * @param resolver The new content handler. + * @exception java.lang.NullPointerException If the handler + * is null. + * @see org.xml.sax.XMLReader#setContentHandler */ public void setContentHandler (ContentHandler handler) { - contentHandler = handler; + if (handler == null) { + throw new NullPointerException("Null content handler"); + } else { + contentHandler = handler; + } } @@ -288,6 +315,7 @@ * Get the content event handler. * * @return The current content handler, or null if none was set. + * @see org.xml.sax.XMLReader#getContentHandler */ public ContentHandler getContentHandler () { @@ -299,10 +327,17 @@ * Set the error event handler. * * @param handle The new error handler. + * @exception java.lang.NullPointerException If the handler + * is null. + * @see org.xml.sax.XMLReader#setErrorHandler */ public void setErrorHandler (ErrorHandler handler) { - errorHandler = handler; + if (handler == null) { + throw new NullPointerException("Null error handler"); + } else { + errorHandler = handler; + } } @@ -310,6 +345,7 @@ * Get the current error event handler. * * @return The current error handler, or null if none was set. + * @see org.xml.sax.XMLReader#getErrorHandler */ public ErrorHandler getErrorHandler () { @@ -326,6 +362,7 @@ * @exception java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. + * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource) */ public void parse (InputSource input) throws SAXException, IOException @@ -344,6 +381,7 @@ * @exception java.io.IOException An IO exception from the parser, * possibly from a byte stream or character stream * supplied by the application. + * @see org.xml.sax.XMLReader#parse(java.lang.String) */ public void parse (String systemId) throws SAXException, IOException @@ -369,6 +407,7 @@ * @exception java.io.IOException The client may throw an * I/O-related exception while obtaining the * new InputSource. + * @see org.xml.sax.EntityResolver#resolveEntity */ public InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException @@ -395,6 +434,7 @@ * @param systemId The notation's system identifier, or null. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.DTDHandler#notationDecl */ public void notationDecl (String name, String publicId, String systemId) throws SAXException @@ -414,6 +454,7 @@ * @param notationName The name of the associated notation. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.DTDHandler#unparsedEntityDecl */ public void unparsedEntityDecl (String name, String publicId, String systemId, String notationName) @@ -436,6 +477,7 @@ * Filter a new document locator event. * * @param locator The document locator. + * @see org.xml.sax.ContentHandler#setDocumentLocator */ public void setDocumentLocator (Locator locator) { @@ -451,6 +493,7 @@ * * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#startDocument */ public void startDocument () throws SAXException @@ -466,6 +509,7 @@ * * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#endDocument */ public void endDocument () throws SAXException @@ -483,6 +527,7 @@ * @param uri The Namespace URI. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#startPrefixMapping */ public void startPrefixMapping (String prefix, String uri) throws SAXException @@ -499,6 +544,7 @@ * @param prefix The Namespace prefix. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#endPrefixMapping */ public void endPrefixMapping (String prefix) throws SAXException @@ -519,6 +565,7 @@ * @param atts The element's attributes. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#startElement */ public void startElement (String uri, String localName, String qName, Attributes atts) @@ -539,6 +586,7 @@ * string. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#endElement */ public void endElement (String uri, String localName, String qName) throws SAXException @@ -557,6 +605,7 @@ * @param length The number of characters to use from the array. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#characters */ public void characters (char ch[], int start, int length) throws SAXException @@ -575,6 +624,7 @@ * @param length The number of characters to use from the array. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#ignorableWhitespace */ public void ignorableWhitespace (char ch[], int start, int length) throws SAXException @@ -592,6 +642,7 @@ * @param data The text following the target. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#processingInstruction */ public void processingInstruction (String target, String data) throws SAXException @@ -608,6 +659,7 @@ * @param name The name of the skipped entity. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ContentHandler#skippedEntity */ public void skippedEntity (String name) throws SAXException @@ -627,9 +679,10 @@ /** * Filter a warning event. * - * @param e The warning as an exception. + * @param e The nwarning as an exception. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ErrorHandler#warning */ public void warning (SAXParseException e) throws SAXException @@ -646,6 +699,7 @@ * @param e The error as an exception. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ErrorHandler#error */ public void error (SAXParseException e) throws SAXException @@ -662,6 +716,7 @@ * @param e The error as an exception. * @exception org.xml.sax.SAXException The client may throw * an exception during processing. + * @see org.xml.sax.ErrorHandler#fatalError */ public void fatalError (SAXParseException e) throws SAXException 1.2.2.1 +14 -27 xml-commons/java/external/src/org/xml/sax/helpers/XMLReaderAdapter.java Index: XMLReaderAdapter.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/XMLReaderAdapter.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- XMLReaderAdapter.java 27 Feb 2002 16:04:18 -0000 1.2 +++ XMLReaderAdapter.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,9 +1,8 @@ // XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser -// http://www.saxproject.org -// Written by David Megginson +// Written by David Megginson, sax@megginson.com // NO WARRANTY! This class is in the public domain. -// $Id: XMLReaderAdapter.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: XMLReaderAdapter.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; @@ -32,8 +31,6 @@ *
    * This module, both source code and documentation, is in the * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. *
    * *

    This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader} @@ -45,8 +42,9 @@ * property, that will also be used to improve efficiency.

    * * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) + * @author David Megginson, + * sax@megginson.com + * @version 2.0 * @see org.xml.sax.Parser * @see org.xml.sax.XMLReader */ @@ -122,7 +120,6 @@ * * @param The locale for error reporting. * @see org.xml.sax.Parser#setLocale - * @exception org.xml.sax.SAXException Thrown unless overridden. */ public void setLocale (Locale locale) throws SAXException @@ -258,8 +255,7 @@ */ public void setDocumentLocator (Locator locator) { - if (documentHandler != null) - documentHandler.setDocumentLocator(locator); + documentHandler.setDocumentLocator(locator); } @@ -273,8 +269,7 @@ public void startDocument () throws SAXException { - if (documentHandler != null) - documentHandler.startDocument(); + documentHandler.startDocument(); } @@ -288,8 +283,7 @@ public void endDocument () throws SAXException { - if (documentHandler != null) - documentHandler.endDocument(); + documentHandler.endDocument(); } @@ -331,10 +325,8 @@ String qName, Attributes atts) throws SAXException { - if (documentHandler != null) { - qAtts.setAttributes(atts); - documentHandler.startElement(qName, qAtts); - } + qAtts.setAttributes(atts); + documentHandler.startElement(qName, qAtts); } @@ -352,8 +344,7 @@ String qName) throws SAXException { - if (documentHandler != null) - documentHandler.endElement(qName); + documentHandler.endElement(qName); } @@ -370,8 +361,7 @@ public void characters (char ch[], int start, int length) throws SAXException { - if (documentHandler != null) - documentHandler.characters(ch, start, length); + documentHandler.characters(ch, start, length); } @@ -388,8 +378,7 @@ public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { - if (documentHandler != null) - documentHandler.ignorableWhitespace(ch, start, length); + documentHandler.ignorableWhitespace(ch, start, length); } @@ -405,8 +394,7 @@ public void processingInstruction (String target, String data) throws SAXException { - if (documentHandler != null) - documentHandler.processingInstruction(target, data); + documentHandler.processingInstruction(target, data); } @@ -415,7 +403,6 @@ * * @param name The name of the skipped entity. * @see org.xml.sax.ContentHandler#skippedEntity - * @exception org.xml.sax.SAXException Throwable by subclasses. */ public void skippedEntity (String name) throws SAXException 1.2.2.1 +5 -8 xml-commons/java/external/src/org/xml/sax/helpers/XMLReaderFactory.java Index: XMLReaderFactory.java =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/XMLReaderFactory.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- XMLReaderFactory.java 27 Feb 2002 16:04:18 -0000 1.2 +++ XMLReaderFactory.java 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -3,8 +3,7 @@ // Written by David Megginson // and by David Brownell // NO WARRANTY! This class is in the Public Domain. - -// $Id: XMLReaderFactory.java,v 1.2 2002/02/27 16:04:18 dims Exp $ +// $Id: XMLReaderFactory.java,v 1.2.2.1 2002/05/10 20:42:39 sboag Exp $ package org.xml.sax.helpers; import java.io.BufferedReader; @@ -45,7 +44,7 @@ * * @since SAX 2.0 * @author David Megginson, David Brownell - * @version 2.0.1 (sax2r2) + * @version 2.0r2pre3 */ final public class XMLReaderFactory { @@ -136,13 +135,11 @@ // 3. Distro-specific fallback if (className == null) { -// BEGIN DISTRIBUTION-SPECIFIC + // modified by neilg in accordance with the "strong encouragement" + // provided to distributions which include parsers. - // EXAMPLE: - // className = "com.example.sax.XmlReader"; - // or a $JAVA_HOME/jre/lib/*properties setting... + className = "org.apache.xerces.parsers.SAXParser"; -// END DISTRIBUTION-SPECIFIC } // do we know the XMLReader implementation class yet? 1.2.2.1 +21 -8 xml-commons/java/external/src/org/xml/sax/helpers/package.html Index: package.html =================================================================== RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/package.html,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- package.html 27 Feb 2002 16:04:18 -0000 1.2 +++ package.html 10 May 2002 20:42:39 -0000 1.2.2.1 @@ -1,13 +1,26 @@ - + + - + + +SAX2 is Free! + - + +

    +SAX helper classes. +

    +

    SAX2 is Free!

    -

    This package contains "helper" classes, including -support for bootstrapping SAX-based applications. +

    I hereby abandon any property rights to SAX 2.0 (the Simple API for +XML), and release all of the SAX 2.0 source code, compiled code, and +documentation contained in this distribution into the Public Domain. +SAX comes with NO WARRANTY or guarantee of fitness for any +purpose.

    -

    See http://www.saxproject.org -for more information about SAX.

    +

    David Megginson, david@megginson.com

    +

    2000-05-05

    - + +