Commit 7a163ec0 by Anthony Green Committed by Tom Tromey

Makefile.am (ordinary_java_source_files): Add org/xml/sax/helpers/NewInstance.java.

2002-12-19  Anthony Green  <green@redhat.com>

	* Makefile.am (ordinary_java_source_files): Add
	org/xml/sax/helpers/NewInstance.java.
	* Makefile.in: Rebuilt.
	* org/xml/sax/package.html, org/xml/sax/ext/package.html,
	org/xml/sax/helpers/package.html: New files.
	* org/xml/sax/*: Upgrade to SAX 2.0.1 release from
	http://www.saxproject.org.

From-SVN: r60350
parent 51d6eed4
2002-12-19 Anthony Green <green@redhat.com>
* Makefile.am (ordinary_java_source_files): Add
org/xml/sax/helpers/NewInstance.java.
* Makefile.in: Rebuilt.
* org/xml/sax/package.html, org/xml/sax/ext/package.html,
org/xml/sax/helpers/package.html: New files.
* org/xml/sax/*: Upgrade to SAX 2.0.1 release from
http://www.saxproject.org.
2002-12-19 Andrew Haley <aph@redhat.com> 2002-12-19 Andrew Haley <aph@redhat.com>
* java/util/natResourceBundle.cc: Include * java/util/natResourceBundle.cc: Include
......
...@@ -2252,6 +2252,7 @@ org/xml/sax/helpers/AttributesImpl.java \ ...@@ -2252,6 +2252,7 @@ org/xml/sax/helpers/AttributesImpl.java \
org/xml/sax/helpers/DefaultHandler.java \ org/xml/sax/helpers/DefaultHandler.java \
org/xml/sax/helpers/LocatorImpl.java \ org/xml/sax/helpers/LocatorImpl.java \
org/xml/sax/helpers/NamespaceSupport.java \ org/xml/sax/helpers/NamespaceSupport.java \
org/xml/sax/helpers/NewInstance.java \
org/xml/sax/helpers/ParserAdapter.java \ org/xml/sax/helpers/ParserAdapter.java \
org/xml/sax/helpers/ParserFactory.java \ org/xml/sax/helpers/ParserFactory.java \
org/xml/sax/helpers/XMLFilterImpl.java \ org/xml/sax/helpers/XMLFilterImpl.java \
......
...@@ -2002,6 +2002,7 @@ org/xml/sax/helpers/AttributesImpl.java \ ...@@ -2002,6 +2002,7 @@ org/xml/sax/helpers/AttributesImpl.java \
org/xml/sax/helpers/DefaultHandler.java \ org/xml/sax/helpers/DefaultHandler.java \
org/xml/sax/helpers/LocatorImpl.java \ org/xml/sax/helpers/LocatorImpl.java \
org/xml/sax/helpers/NamespaceSupport.java \ org/xml/sax/helpers/NamespaceSupport.java \
org/xml/sax/helpers/NewInstance.java \
org/xml/sax/helpers/ParserAdapter.java \ org/xml/sax/helpers/ParserAdapter.java \
org/xml/sax/helpers/ParserFactory.java \ org/xml/sax/helpers/ParserFactory.java \
org/xml/sax/helpers/XMLFilterImpl.java \ org/xml/sax/helpers/XMLFilterImpl.java \
...@@ -3701,6 +3702,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3701,6 +3702,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/org/xml/sax/helpers/DefaultHandler.P \ .deps/org/xml/sax/helpers/DefaultHandler.P \
.deps/org/xml/sax/helpers/LocatorImpl.P \ .deps/org/xml/sax/helpers/LocatorImpl.P \
.deps/org/xml/sax/helpers/NamespaceSupport.P \ .deps/org/xml/sax/helpers/NamespaceSupport.P \
.deps/org/xml/sax/helpers/NewInstance.P \
.deps/org/xml/sax/helpers/ParserAdapter.P \ .deps/org/xml/sax/helpers/ParserAdapter.P \
.deps/org/xml/sax/helpers/ParserFactory.P \ .deps/org/xml/sax/helpers/ParserFactory.P \
.deps/org/xml/sax/helpers/XMLFilterImpl.P \ .deps/org/xml/sax/helpers/XMLFilterImpl.P \
......
// SAX DTD handler. // SAX DTD handler.
// No warranty; no copyright -- use this as you will. // http://www.saxproject.org
// $Id: DTDHandler.java,v 1.1 2000/10/02 02:43:17 sboag Exp $ // No warranty; no copyright -- use this as you will.
// $Id: DTDHandler.java,v 1.5.2.4 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax;
package org.xml.sax;
/**
* Receive notification of basic DTD-related events. /**
* * Receive notification of basic DTD-related events.
* <blockquote> *
* <em>This module, both source code and documentation, is in the * <blockquote>
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * <em>This module, both source code and documentation, is in the
* </blockquote> * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* <p>If a SAX application needs information about notations and * for further information.
* unparsed entities, then the application implements this * </blockquote>
* interface and registers an instance with the SAX parser using *
* the parser's setDTDHandler method. The parser uses the * <p>If a SAX application needs information about notations and
* instance to report notation and unparsed entity declarations to * unparsed entities, then the application implements this
* the application.</p> * interface and registers an instance with the SAX parser using
* * the parser's setDTDHandler method. The parser uses the
* <p>Note that this interface includes only those DTD events that * instance to report notation and unparsed entity declarations to
* the XML recommendation <em>requires</em> processors to report: * the application.</p>
* notation and unparsed entity declarations.</p> *
* * <p>Note that this interface includes only those DTD events that
* <p>The SAX parser may report these events in any order, regardless * the XML recommendation <em>requires</em> processors to report:
* of the order in which the notations and unparsed entities were * notation and unparsed entity declarations.</p>
* declared; however, all DTD events must be reported after the *
* document handler's startDocument event, and before the first * <p>The SAX parser may report these events in any order, regardless
* startElement event.</p> * of the order in which the notations and unparsed entities were
* * declared; however, all DTD events must be reported after the
* <p>It is up to the application to store the information for * document handler's startDocument event, and before the first
* future use (perhaps in a hash table or object tree). * startElement event.
* If the application encounters attributes of type "NOTATION", * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
* "ENTITY", or "ENTITIES", it can use the information that it * used, these events must also be reported before the endDTD event.)
* obtained through this interface to find the entity and/or * </p>
* notation corresponding with the attribute value.</p> *
* * <p>It is up to the application to store the information for
* @since SAX 1.0 * future use (perhaps in a hash table or object tree).
* @author David Megginson, * If the application encounters attributes of type "NOTATION",
* <a href="mailto:sax@megginson.com">sax@megginson.com</a> * "ENTITY", or "ENTITIES", it can use the information that it
* @version 2.0 * obtained through this interface to find the entity and/or
* @see org.xml.sax.Parser#setDTDHandler * notation corresponding with the attribute value.</p>
* @see org.xml.sax.HandlerBase *
*/ * @since SAX 1.0
public interface DTDHandler { * @author David Megginson
* @version 2.0.1 (sax2r2)
* @see org.xml.sax.XMLReader#setDTDHandler
/** */
* Receive notification of a notation declaration event. public interface DTDHandler {
*
* <p>It is up to the application to record the notation for later
* reference, if necessary.</p> /**
* * Receive notification of a notation declaration event.
* <p>At least one of publicId and systemId must be non-null. *
* If a system identifier is present, and it is a URL, the SAX * <p>It is up to the application to record the notation for later
* parser must resolve it fully before passing it to the * reference, if necessary;
* application through this event.</p> * notations may appear as attribute values and in unparsed entity
* * declarations, and are sometime used with processing instruction
* <p>There is no guarantee that the notation declaration will be * target names.</p>
* reported before any unparsed entities that use it.</p> *
* * <p>At least one of publicId and systemId must be non-null.
* @param name The notation name. * If a system identifier is present, and it is a URL, the SAX
* @param publicId The notation's public identifier, or null if * parser must resolve it fully before passing it to the
* none was given. * application through this event.</p>
* @param systemId The notation's system identifier, or null if *
* none was given. * <p>There is no guarantee that the notation declaration will be
* @exception org.xml.sax.SAXException Any SAX exception, possibly * reported before any unparsed entities that use it.</p>
* wrapping another exception. *
* @see #unparsedEntityDecl * @param name The notation name.
* @see org.xml.sax.AttributeList * @param publicId The notation's public identifier, or null if
*/ * none was given.
public abstract void notationDecl (String name, * @param systemId The notation's system identifier, or null if
String publicId, * none was given.
String systemId) * @exception org.xml.sax.SAXException Any SAX exception, possibly
throws SAXException; * wrapping another exception.
* @see #unparsedEntityDecl
* @see org.xml.sax.Attributes
/** */
* Receive notification of an unparsed entity declaration event. public abstract void notationDecl (String name,
* String publicId,
* <p>Note that the notation name corresponds to a notation String systemId)
* reported by the {@link #notationDecl notationDecl} event. throws SAXException;
* It is up to the application to record the entity for later
* reference, if necessary.</p>
* /**
* <p>If the system identifier is a URL, the parser must resolve it * Receive notification of an unparsed entity declaration event.
* fully before passing it to the application.</p> *
* * <p>Note that the notation name corresponds to a notation
* @exception org.xml.sax.SAXException Any SAX exception, possibly * reported by the {@link #notationDecl notationDecl} event.
* wrapping another exception. * It is up to the application to record the entity for later
* @param name The unparsed entity's name. * reference, if necessary;
* @param publicId The entity's public identifier, or null if none * unparsed entities may appear as attribute values.
* was given. * </p>
* @param systemId The entity's system identifier. *
* @param notation name The name of the associated notation. * <p>If the system identifier is a URL, the parser must resolve it
* @see #notationDecl * fully before passing it to the application.</p>
* @see org.xml.sax.AttributeList *
*/ * @exception org.xml.sax.SAXException Any SAX exception, possibly
public abstract void unparsedEntityDecl (String name, * wrapping another exception.
String publicId, * @param name The unparsed entity's name.
String systemId, * @param publicId The entity's public identifier, or null if none
String notationName) * was given.
throws SAXException; * @param systemId The entity's system identifier.
* @param notationName The name of the associated notation.
} * @see #notationDecl
* @see org.xml.sax.Attributes
// end of DTDHandler.java */
public abstract void unparsedEntityDecl (String name,
String publicId,
String systemId,
String notationName)
throws SAXException;
}
// end of DTDHandler.java
// SAX entity resolver. // SAX entity resolver.
// No warranty; no copyright -- use this as you will. // http://www.saxproject.org
// $Id: EntityResolver.java,v 1.1 2000/10/02 02:43:17 sboag Exp $ // No warranty; no copyright -- use this as you will.
// $Id: EntityResolver.java,v 1.7.2.3 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax;
package org.xml.sax;
import java.io.IOException;
import java.io.IOException;
/**
* Basic interface for resolving entities. /**
* * Basic interface for resolving entities.
* <blockquote> *
* <em>This module, both source code and documentation, is in the * <blockquote>
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * <em>This module, both source code and documentation, is in the
* </blockquote> * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* <p>If a SAX application needs to implement customized handling * for further information.
* for external entities, it must implement this interface and * </blockquote>
* register an instance with the SAX driver using the *
* {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver} * <p>If a SAX application needs to implement customized handling
* method.</p> * for external entities, it must implement this interface and
* * register an instance with the SAX driver using the
* <p>The XML reader will then allow the application to intercept any * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver}
* external entities (including the external DTD subset and external * method.</p>
* parameter entities, if any) before including them.</p> *
* * <p>The XML reader will then allow the application to intercept any
* <p>Many SAX applications will not need to implement this interface, * external entities (including the external DTD subset and external
* but it will be especially useful for applications that build * parameter entities, if any) before including them.</p>
* XML documents from databases or other specialised input sources, *
* or for applications that use URI types other than URLs.</p> * <p>Many SAX applications will not need to implement this interface,
* * but it will be especially useful for applications that build
* <p>The following resolver would provide the application * XML documents from databases or other specialised input sources,
* with a special character stream for the entity with the system * or for applications that use URI types other than URLs.</p>
* identifier "http://www.myhost.com/today":</p> *
* * <p>The following resolver would provide the application
* <pre> * with a special character stream for the entity with the system
* import org.xml.sax.EntityResolver; * identifier "http://www.myhost.com/today":</p>
* import org.xml.sax.InputSource; *
* * <pre>
* public class MyResolver implements EntityResolver { * import org.xml.sax.EntityResolver;
* public InputSource resolveEntity (String publicId, String systemId) * import org.xml.sax.InputSource;
* { *
* if (systemId.equals("http://www.myhost.com/today")) { * public class MyResolver implements EntityResolver {
* // return a special input source * public InputSource resolveEntity (String publicId, String systemId)
* MyReader reader = new MyReader(); * {
* return new InputSource(reader); * if (systemId.equals("http://www.myhost.com/today")) {
* } else { * // return a special input source
* // use the default behaviour * MyReader reader = new MyReader();
* return null; * return new InputSource(reader);
* } * } else {
* } * // use the default behaviour
* } * return null;
* </pre> * }
* * }
* <p>The application can also use this interface to redirect system * }
* identifiers to local URIs or to look up replacements in a catalog * </pre>
* (possibly by using the public identifier).</p> *
* * <p>The application can also use this interface to redirect system
* @since SAX 1.0 * identifiers to local URIs or to look up replacements in a catalog
* @author David Megginson, * (possibly by using the public identifier).</p>
* <a href="mailto:sax@megginson.com">sax@megginson.com</a> *
* @version 2.0 * @since SAX 1.0
* @see org.xml.sax.Parser#setEntityResolver * @author David Megginson
* @see org.xml.sax.InputSource * @version 2.0.1 (sax2r2)
*/ * @see org.xml.sax.XMLReader#setEntityResolver
public interface EntityResolver { * @see org.xml.sax.InputSource
*/
public interface EntityResolver {
/**
* Allow the application to resolve external entities.
* /**
* <p>The Parser will call this method before opening any external * Allow the application to resolve external entities.
* entity except the top-level document entity (including the *
* external DTD subset, external entities referenced within the * <p>The parser will call this method before opening any external
* DTD, and external entities referenced within the document * entity except the top-level document entity. Such entities include
* element): the application may request that the parser resolve * the external DTD subset and external parameter entities referenced
* the entity itself, that it use an alternative URI, or that it * within the DTD (in either case, only if the parser reads external
* use an entirely different input source.</p> * parameter entities), and external general entities referenced
* * within the document element (if the parser reads external general
* <p>Application writers can use this method to redirect external * entities). The application may request that the parser locate
* system identifiers to secure and/or local URIs, to look up * the entity itself, that it use an alternative URI, or that it
* public identifiers in a catalogue, or to read an entity from a * use data provided by the application (as a character or byte
* database or other input source (including, for example, a dialog * input stream).</p>
* box).</p> *
* * <p>Application writers can use this method to redirect external
* <p>If the system identifier is a URL, the SAX parser must * system identifiers to secure and/or local URIs, to look up
* resolve it fully before reporting it to the application.</p> * public identifiers in a catalogue, or to read an entity from a
* * database or other input source (including, for example, a dialog
* @param publicId The public identifier of the external entity * box). Neither XML nor SAX specifies a preferred policy for using
* being referenced, or null if none was supplied. * public or system IDs to resolve resources. However, SAX specifies
* @param systemId The system identifier of the external entity * how to interpret any InputSource returned by this method, and that
* being referenced. * if none is returned, then the system ID will be dereferenced as
* @return An InputSource object describing the new input source, * a URL. </p>
* or null to request that the parser open a regular *
* URI connection to the system identifier. * <p>If the system identifier is a URL, the SAX parser must
* @exception org.xml.sax.SAXException Any SAX exception, possibly * resolve it fully before reporting it to the application.</p>
* wrapping another exception. *
* @exception java.io.IOException A Java-specific IO exception, * @param publicId The public identifier of the external entity
* possibly the result of creating a new InputStream * being referenced, or null if none was supplied.
* or Reader for the InputSource. * @param systemId The system identifier of the external entity
* @see org.xml.sax.InputSource * being referenced.
*/ * @return An InputSource object describing the new input source,
public abstract InputSource resolveEntity (String publicId, * or null to request that the parser open a regular
String systemId) * URI connection to the system identifier.
throws SAXException, IOException; * @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
} * @exception java.io.IOException A Java-specific IO exception,
* possibly the result of creating a new InputStream
// end of EntityResolver.java * or Reader for the InputSource.
* @see org.xml.sax.InputSource
*/
public abstract InputSource resolveEntity (String publicId,
String systemId)
throws SAXException, IOException;
}
// end of EntityResolver.java
// SAX exception class. // SAX exception class.
// No warranty; no copyright -- use this as you will. // http://www.saxproject.org
// $Id: SAXException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $ // No warranty; no copyright -- use this as you will.
// $Id: SAXException.java,v 1.4.2.4 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax;
package org.xml.sax;
/**
* Encapsulate a general SAX error or warning. /**
* * Encapsulate a general SAX error or warning.
* <blockquote> *
* <em>This module, both source code and documentation, is in the * <blockquote>
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * <em>This module, both source code and documentation, is in the
* </blockquote> * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* <p>This class can contain basic error or warning information from * for further information.
* either the XML parser or the application: a parser writer or * </blockquote>
* application writer can subclass it to provide additional *
* functionality. SAX handlers may throw this exception or * <p>This class can contain basic error or warning information from
* any exception subclassed from it.</p> * either the XML parser or the application: a parser writer or
* * application writer can subclass it to provide additional
* <p>If the application needs to pass through other types of * functionality. SAX handlers may throw this exception or
* exceptions, it must wrap those exceptions in a SAXException * any exception subclassed from it.</p>
* or an exception derived from a SAXException.</p> *
* * <p>If the application needs to pass through other types of
* <p>If the parser or application needs to include information about a * exceptions, it must wrap those exceptions in a SAXException
* specific location in an XML document, it should use the * or an exception derived from a SAXException.</p>
* {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p> *
* * <p>If the parser or application needs to include information about a
* @since SAX 1.0 * specific location in an XML document, it should use the
* @author David Megginson, * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>
* <a href="mailto:sax@megginson.com">sax@megginson.com</a> *
* @version 2.0 * @since SAX 1.0
* @see org.xml.sax.SAXParseException * @author David Megginson
*/ * @version 2.0.1 (sax2r2)
public class SAXException extends Exception { * @see org.xml.sax.SAXParseException
*/
public class SAXException extends Exception {
/**
* Create a new SAXException.
* /**
* @param message The error or warning message. * Create a new SAXException.
* @see org.xml.sax.Parser#setLocale */
*/ public SAXException ()
public SAXException (String message) { {
super(message); super();
this.exception = null; this.exception = null;
} }
/** /**
* Create a new SAXException wrapping an existing exception. * Create a new SAXException.
* *
* <p>The existing exception will be embedded in the new * @param message The error or warning message.
* one, and its message will become the default message for */
* the SAXException.</p> public SAXException (String message) {
* super(message);
* @param e The exception to be wrapped in a SAXException. this.exception = null;
*/ }
public SAXException (Exception e)
{
super(); /**
this.exception = e; * Create a new SAXException wrapping an existing exception.
} *
* <p>The existing exception will be embedded in the new
* one, and its message will become the default message for
/** * the SAXException.</p>
* Create a new SAXException from an existing exception. *
* * @param e The exception to be wrapped in a SAXException.
* <p>The existing exception will be embedded in the new */
* one, but the new exception will have its own message.</p> public SAXException (Exception e)
* {
* @param message The detail message. super();
* @param e The exception to be wrapped in a SAXException. this.exception = e;
* @see org.xml.sax.Parser#setLocale }
*/
public SAXException (String message, Exception e)
{ /**
super(message); * Create a new SAXException from an existing exception.
this.exception = e; *
} * <p>The existing exception will be embedded in the new
* one, but the new exception will have its own message.</p>
*
/** * @param message The detail message.
* Return a detail message for this exception. * @param e The exception to be wrapped in a SAXException.
* */
* <p>If there is an embedded exception, and if the SAXException public SAXException (String message, Exception e)
* has no detail message of its own, this method will return {
* the detail message from the embedded exception.</p> super(message);
* this.exception = e;
* @return The error or warning message. }
* @see org.xml.sax.Parser#setLocale
*/
public String getMessage () /**
{ * Return a detail message for this exception.
String message = super.getMessage(); *
* <p>If there is an embedded exception, and if the SAXException
if (message == null && exception != null) { * has no detail message of its own, this method will return
return exception.getMessage(); * the detail message from the embedded exception.</p>
} else { *
return message; * @return The error or warning message.
} */
} public String getMessage ()
{
String message = super.getMessage();
/**
* Return the embedded exception, if any. if (message == null && exception != null) {
* return exception.getMessage();
* @return The embedded exception, or null if there is none. } else {
*/ return message;
public Exception getException () }
{ }
return exception;
}
/**
* Return the embedded exception, if any.
/** *
* Override toString to pick up any embedded exception. * @return The embedded exception, or null if there is none.
* */
* @return A string representation of this exception. public Exception getException ()
*/ {
public String toString () return exception;
{ }
if (exception != null) {
return exception.toString();
} else { /**
return super.toString(); * Override toString to pick up any embedded exception.
} *
} * @return A string representation of this exception.
*/
public String toString ()
{
////////////////////////////////////////////////////////////////////// if (exception != null) {
// Internal state. return exception.toString();
////////////////////////////////////////////////////////////////////// } else {
return super.toString();
}
/** }
* @serial The embedded exception if tunnelling, or null.
*/
private Exception exception;
//////////////////////////////////////////////////////////////////////
} // Internal state.
//////////////////////////////////////////////////////////////////////
// end of SAXException.java
/**
* @serial The embedded exception if tunnelling, or null.
*/
private Exception exception;
}
// end of SAXException.java
// SAXNotRecognizedException.java - unrecognized feature or value. // SAXNotRecognizedException.java - unrecognized feature or value.
// Written by David Megginson, sax@megginson.com // http://www.saxproject.org
// NO WARRANTY! This class is in the Public Domain. // Written by David Megginson
// NO WARRANTY! This class is in the Public Domain.
// $Id: SAXNotRecognizedException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
// $Id: SAXNotRecognizedException.java,v 1.4.2.3 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax;
package org.xml.sax;
/**
* Exception class for an unrecognized identifier. /**
* * Exception class for an unrecognized identifier.
* <blockquote> *
* <em>This module, both source code and documentation, is in the * <blockquote>
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * <em>This module, both source code and documentation, is in the
* </blockquote> * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* <p>An XMLReader will throw this exception when it finds an * for further information.
* unrecognized feature or property identifier; SAX applications and * </blockquote>
* extensions may use this class for other, similar purposes.</p> *
* * <p>An XMLReader will throw this exception when it finds an
* @since SAX 2.0 * unrecognized feature or property identifier; SAX applications and
* @author David Megginson, * extensions may use this class for other, similar purposes.</p>
* <a href="mailto:sax@megginson.com">sax@megginson.com</a> *
* @version 2.0 * @since SAX 2.0
* @see org.xml.sax.SAXNotSupportedException * @author David Megginson
*/ * @version 2.0.1 (sax2r2)
public class SAXNotRecognizedException extends SAXException * @see org.xml.sax.SAXNotSupportedException
{ */
public class SAXNotRecognizedException extends SAXException
/** {
* Construct a new exception with the given message.
* /**
* @param message The text message of the exception. * Default constructor.
*/ */
public SAXNotRecognizedException (String message) public SAXNotRecognizedException ()
{ {
super(message); super();
} }
}
/**
// end of SAXNotRecognizedException.java * Construct a new exception with the given message.
*
* @param message The text message of the exception.
*/
public SAXNotRecognizedException (String message)
{
super(message);
}
}
// end of SAXNotRecognizedException.java
// SAXNotSupportedException.java - unsupported feature or value. // SAXNotSupportedException.java - unsupported feature or value.
// Written by David Megginson, sax@megginson.com // http://www.saxproject.org
// NO WARRANTY! This class is in the Public Domain. // Written by David Megginson
// NO WARRANTY! This class is in the Public Domain.
// $Id: SAXNotSupportedException.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
// $Id: SAXNotSupportedException.java,v 1.4.2.3 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax;
package org.xml.sax;
/**
* Exception class for an unsupported operation. /**
* * Exception class for an unsupported operation.
* <blockquote> *
* <em>This module, both source code and documentation, is in the * <blockquote>
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * <em>This module, both source code and documentation, is in the
* </blockquote> * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* <p>An XMLReader will throw this exception when it recognizes a * for further information.
* feature or property identifier, but cannot perform the requested * </blockquote>
* operation (setting a state or value). Other SAX2 applications and *
* extensions may use this class for similar purposes.</p> * <p>An XMLReader will throw this exception when it recognizes a
* * feature or property identifier, but cannot perform the requested
* @since SAX 2.0 * operation (setting a state or value). Other SAX2 applications and
* @author David Megginson, * extensions may use this class for similar purposes.</p>
* <a href="mailto:sax@megginson.com">sax@megginson.com</a> *
* @version 2.0 * @since SAX 2.0
* @see org.xml.sax.SAXNotRecognizedException * @author David Megginson
*/ * @version 2.0.1 (sax2r2)
public class SAXNotSupportedException extends SAXException * @see org.xml.sax.SAXNotRecognizedException
{ */
public class SAXNotSupportedException extends SAXException
/** {
* Construct a new exception with the given message.
* /**
* @param message The text message of the exception. * Construct a new exception with no message.
*/ */
public SAXNotSupportedException (String message) public SAXNotSupportedException ()
{ {
super(message); super();
} }
}
/**
// end of SAXNotSupportedException.java * Construct a new exception with the given message.
*
* @param message The text message of the exception.
*/
public SAXNotSupportedException (String message)
{
super(message);
}
}
// end of SAXNotSupportedException.java
// XMLFilter.java - filter SAX2 events. // XMLFilter.java - filter SAX2 events.
// Written by David Megginson, sax@megginson.com // http://www.saxproject.org
// NO WARRANTY! This class is in the Public Domain. // Written by David Megginson
// NO WARRANTY! This class is in the Public Domain.
// $Id: XMLFilter.java,v 1.1 2000/10/02 02:43:17 sboag Exp $
// $Id: XMLFilter.java,v 1.3.2.3 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax;
package org.xml.sax;
/**
* Interface for an XML filter. /**
* * Interface for an XML filter.
* <blockquote> *
* <em>This module, both source code and documentation, is in the * <blockquote>
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * <em>This module, both source code and documentation, is in the
* </blockquote> * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* <p>An XML filter is like an XML reader, except that it obtains its * for further information.
* events from another XML reader rather than a primary source like * </blockquote>
* an XML document or database. Filters can modify a stream of *
* events as they pass on to the final application.</p> * <p>An XML filter is like an XML reader, except that it obtains its
* * events from another XML reader rather than a primary source like
* <p>The XMLFilterImpl helper class provides a convenient base * an XML document or database. Filters can modify a stream of
* for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver * events as they pass on to the final application.</p>
* EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler}, *
* {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler * <p>The XMLFilterImpl helper class provides a convenient base
* ErrorHandler} events automatically.</p> * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver
* * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},
* @since SAX 2.0 * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler
* @author David Megginson, * ErrorHandler} events automatically.</p>
* <a href="mailto:sax@megginson.com">sax@megginson.com</a> *
* @version 2.0 * @since SAX 2.0
* @see org.xml.sax.helpers.XMLFilterImpl * @author David Megginson
*/ * @version 2.0.1 (sax2r2)
public interface XMLFilter extends XMLReader * @see org.xml.sax.helpers.XMLFilterImpl
{ */
public interface XMLFilter extends XMLReader
/** {
* Set the parent reader.
* /**
* <p>This method allows the application to link the filter to * Set the parent reader.
* a parent reader (which may be another filter). The argument *
* may not be null.</p> * <p>This method allows the application to link the filter to
* * a parent reader (which may be another filter). The argument
* @param parent The parent reader. * may not be null.</p>
*/ *
public abstract void setParent (XMLReader parent); * @param parent The parent reader.
*/
public abstract void setParent (XMLReader parent);
/**
* Get the parent reader.
* /**
* <p>This method allows the application to query the parent * Get the parent reader.
* reader (which may be another filter). It is generally a *
* bad idea to perform any operations on the parent reader * <p>This method allows the application to query the parent
* directly: they should all pass through this filter.</p> * reader (which may be another filter). It is generally a
* * bad idea to perform any operations on the parent reader
* @return The parent filter, or null if none has been set. * directly: they should all pass through this filter.</p>
*/ *
public abstract XMLReader getParent (); * @return The parent filter, or null if none has been set.
*/
} public abstract XMLReader getParent ();
// end of XMLFilter.java }
// end of XMLFilter.java
<HTML><HEAD>
</HEAD><BODY>
<p>
This package contains interfaces to optional SAX2 handlers.
<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
for more information about SAX.</p>
<p>
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:</p>
<ul>
<li>SAX2 drivers are <em>not</em> required to recognize these handlers,
and you cannot assume that the class files will be present in every SAX2
installation.</li>
<li>This package may be updated independently of SAX2 (i.e. new
handlers may be added without updating SAX2 itself).</li>
<li>The handlers are not implemented by the SAX2
<code>org.xml.sax.helpers.DefaultHandler</code> or
<code>org.xml.sax.helpers.XMLFilterImpl</code> classes.
You can subclass these if you need such behaviour.</li>
<li>The handlers need to be registered differently than regular SAX2
handlers.</li>
</ul>
<p>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. </p>
<p><strong>NOTE:</strong> 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.</p>
</BODY></HTML>
// NewInstance.java - create a new instance of a class by name.
// http://www.saxproject.org
// 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.2.4 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax.helpers;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
/**
* Create a new instance of a class by name.
*
* <blockquote>
* <em>This module, both source code and documentation, is in the
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* for further information.
* </blockquote>
*
* <p>This class contains a static method for creating an instance of a
* class from an explicit class name. It tries to use the thread's context
* ClassLoader if possible and falls back to using
* Class.forName(String).</p>
*
* <p>This code is designed to compile and run on JDK version 1.1 and later
* including versions of Java 2.</p>
*
* @author Edwin Goei, David Brownell
* @version 2.0.1 (sax2r2)
*/
class NewInstance {
/**
* Creates a new instance of the specified class name
*
* Package private so this code is not exposed at the API level.
*/
static Object newInstance (ClassLoader classLoader, String className)
throws ClassNotFoundException, IllegalAccessException,
InstantiationException
{
Class driverClass;
if (classLoader == null) {
driverClass = Class.forName(className);
} else {
driverClass = classLoader.loadClass(className);
}
return driverClass.newInstance();
}
/**
* Figure out which ClassLoader to use. For JDK 1.2 and later use
* the context ClassLoader.
*/
static ClassLoader getClassLoader ()
{
Method m = null;
try {
m = Thread.class.getMethod("getContextClassLoader", null);
} catch (NoSuchMethodException e) {
// Assume that we are running JDK 1.1, use the current ClassLoader
return NewInstance.class.getClassLoader();
}
try {
return (ClassLoader) m.invoke(Thread.currentThread(), null);
} catch (IllegalAccessException e) {
// assert(false)
throw new UnknownError(e.getMessage());
} catch (InvocationTargetException e) {
// assert(e.getTargetException() instanceof SecurityException)
throw new UnknownError(e.getMessage());
}
}
}
// SAX parser factory. // SAX parser factory.
// No warranty; no copyright -- use this as you will. // http://www.saxproject.org
// $Id: ParserFactory.java,v 1.1 2000/10/02 02:43:20 sboag Exp $ // No warranty; no copyright -- use this as you will.
// $Id: ParserFactory.java,v 1.4.2.3 2002/01/29 21:34:14 dbrownell Exp $
package org.xml.sax.helpers;
package org.xml.sax.helpers;
import java.lang.ClassNotFoundException;
import java.lang.IllegalAccessException; import java.lang.ClassNotFoundException;
import java.lang.InstantiationException; import java.lang.IllegalAccessException;
import java.lang.SecurityException; import java.lang.InstantiationException;
import java.lang.ClassCastException; import java.lang.SecurityException;
import java.lang.ClassCastException;
import org.xml.sax.Parser;
import org.xml.sax.Parser;
/**
* Java-specific class for dynamically loading SAX parsers. /**
* * Java-specific class for dynamically loading SAX parsers.
* <blockquote> *
* <em>This module, both source code and documentation, is in the * <blockquote>
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> * <em>This module, both source code and documentation, is in the
* </blockquote> * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
* * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
* <p><strong>Note:</strong> This class is designed to work with the now-deprecated * for further information.
* SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use * </blockquote>
* {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p> *
* * <p><strong>Note:</strong> This class is designed to work with the now-deprecated
* <p>ParserFactory is not part of the platform-independent definition * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use
* of SAX; it is an additional convenience class designed * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>
* specifically for Java XML application writers. SAX applications *
* can use the static methods in this class to allocate a SAX parser * <p>ParserFactory is not part of the platform-independent definition
* dynamically at run-time based either on the value of the * of SAX; it is an additional convenience class designed
* `org.xml.sax.parser' system property or on a string containing the class * specifically for Java XML application writers. SAX applications
* name.</p> * can use the static methods in this class to allocate a SAX parser
* * dynamically at run-time based either on the value of the
* <p>Note that the application still requires an XML parser that * `org.xml.sax.parser' system property or on a string containing the class
* implements SAX1.</p> * name.</p>
* *
* @deprecated This class works with the deprecated * <p>Note that the application still requires an XML parser that
* {@link org.xml.sax.Parser Parser} * implements SAX1.</p>
* interface. *
* @since SAX 1.0 * @deprecated This class works with the deprecated
* @author David Megginson, * {@link org.xml.sax.Parser Parser}
* <a href="mailto:sax@megginson.com">sax@megginson.com</a> * interface.
* @version 2.0 * @since SAX 1.0
* @see org.xml.sax.Parser * @author David Megginson
* @see java.lang.Class * @version 2.0.1 (sax2r2)
*/ */
public class ParserFactory { public class ParserFactory {
/** /**
* Private null constructor. * Private null constructor.
*/ */
private ParserFactory () private ParserFactory ()
{ {
} }
/** /**
* Create a new SAX parser using the `org.xml.sax.parser' system property. * Create a new SAX parser using the `org.xml.sax.parser' system property.
* *
* <p>The named class must exist and must implement the * <p>The named class must exist and must implement the
* {@link org.xml.sax.Parser Parser} interface.</p> * {@link org.xml.sax.Parser Parser} interface.</p>
* *
* @exception java.lang.NullPointerException There is no value * @exception java.lang.NullPointerException There is no value
* for the `org.xml.sax.parser' system property. * for the `org.xml.sax.parser' system property.
* @exception java.lang.ClassNotFoundException The SAX parser * @exception java.lang.ClassNotFoundException The SAX parser
* class was not found (check your CLASSPATH). * class was not found (check your CLASSPATH).
* @exception IllegalAccessException The SAX parser class was * @exception IllegalAccessException The SAX parser class was
* found, but you do not have permission to load * found, but you do not have permission to load
* it. * it.
* @exception InstantiationException The SAX parser class was * @exception InstantiationException The SAX parser class was
* found but could not be instantiated. * found but could not be instantiated.
* @exception java.lang.ClassCastException The SAX parser class * @exception java.lang.ClassCastException The SAX parser class
* was found and instantiated, but does not implement * was found and instantiated, but does not implement
* org.xml.sax.Parser. * org.xml.sax.Parser.
* @see #makeParser(java.lang.String) * @see #makeParser(java.lang.String)
* @see org.xml.sax.Parser * @see org.xml.sax.Parser
*/ */
public static Parser makeParser () public static Parser makeParser ()
throws ClassNotFoundException, throws ClassNotFoundException,
IllegalAccessException, IllegalAccessException,
InstantiationException, InstantiationException,
NullPointerException, NullPointerException,
ClassCastException ClassCastException
{ {
String className = System.getProperty("org.xml.sax.parser"); String className = System.getProperty("org.xml.sax.parser");
if (className == null) { if (className == null) {
throw new NullPointerException("No value for sax.parser property"); throw new NullPointerException("No value for sax.parser property");
} else { } else {
return makeParser(className); return makeParser(className);
} }
} }
/** /**
* Create a new SAX parser object using the class name provided. * Create a new SAX parser object using the class name provided.
* *
* <p>The named class must exist and must implement the * <p>The named class must exist and must implement the
* {@link org.xml.sax.Parser Parser} interface.</p> * {@link org.xml.sax.Parser Parser} interface.</p>
* *
* @param className A string containing the name of the * @param className A string containing the name of the
* SAX parser class. * SAX parser class.
* @exception java.lang.ClassNotFoundException The SAX parser * @exception java.lang.ClassNotFoundException The SAX parser
* class was not found (check your CLASSPATH). * class was not found (check your CLASSPATH).
* @exception IllegalAccessException The SAX parser class was * @exception IllegalAccessException The SAX parser class was
* found, but you do not have permission to load * found, but you do not have permission to load
* it. * it.
* @exception InstantiationException The SAX parser class was * @exception InstantiationException The SAX parser class was
* found but could not be instantiated. * found but could not be instantiated.
* @exception java.lang.ClassCastException The SAX parser class * @exception java.lang.ClassCastException The SAX parser class
* was found and instantiated, but does not implement * was found and instantiated, but does not implement
* org.xml.sax.Parser. * org.xml.sax.Parser.
* @see #makeParser() * @see #makeParser()
* @see org.xml.sax.Parser * @see org.xml.sax.Parser
*/ */
public static Parser makeParser (String className) public static Parser makeParser (String className)
throws ClassNotFoundException, throws ClassNotFoundException,
IllegalAccessException, IllegalAccessException,
InstantiationException, InstantiationException,
ClassCastException ClassCastException
{ {
return (Parser)(Class.forName(className).newInstance()); return (Parser) NewInstance.newInstance (
} NewInstance.getClassLoader (), className);
}
}
}
// end of ParserFactory.java
<HTML><HEAD>
<!-- $Id: package.html,v 1.3.2.1 2001/11/09 20:32:58 dbrownell Exp $ -->
</HEAD><BODY>
<p>This package contains "helper" classes, including
support for bootstrapping SAX-based applications.
<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
for more information about SAX.</p>
</BODY></HTML>
<html><head>
<!-- $Id: package.html,v 1.2.2.2 2002/01/12 21:42:21 dbrownell Exp $ -->
</head><body>
<p> 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. </p>
<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
for more information about SAX.</p>
<h2> SAX2 Standard Feature Flags </h2>
<p> 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
<code>http://xml.org/sax/features/</code> before an identifier such as
<code>validation</code>. Turn features on or off using
<em>setFeature</em>. Those standard identifiers are: </p>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr align="center" bgcolor="#ccccff">
<th>Feature ID</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>external-general-entities</td>
<td><em>unspecified</em></td>
<td> Reports whether this parser processes external
general entities; always true if validating</td>
</tr>
<tr>
<td>external-parameter-entities</td>
<td><em>unspecified</em></td>
<td> Reports whether this parser processes external
parameter entities; always true if validating</td>
</tr>
<tr>
<td>lexical-handler/parameter-entities</td>
<td><em>unspecified</em></td>
<td> true indicates that the LexicalHandler will report the
beginning and end of parameter entities
</td>
</tr>
<tr>
<td>namespaces</td>
<td>true</td>
<td> true indicates namespace URIs and unprefixed local names
for element and attribute names will be available </td>
</tr>
<tr>
<td>namespace-prefixes</td>
<td>false</td>
<td> true indicates XML 1.0 names (with prefixes) and attributes
(including <em>xmlns*</em> attributes) will be available </td>
</tr>
<tr>
<td>string-interning</td>
<td><em>unspecified</em></td>
<td> true if all XML names (for elements, prefixes, attributes,
entities, notations, and local names),
as well as Namespace URIs, will have been interned
using <em>java.lang.String.intern</em>. This supports fast
testing of equality/inequality against string constants.</td>
</tr>
<tr>
<td>validation</td>
<td><em>unspecified</em></td>
<td> controls whether the parser is reporting all validity
errors; if true, all external entities will be read. </td>
</tr>
</table>
<p> Support for the default values of the
<em>namespaces</em> and <em>namespace-prefixes</em>
properties is required.
</p>
<p> 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.
</p>
<h2> SAX2 Standard Handler and Property IDs </h2>
<p> 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
<code>http://xml.org/sax/properties/</code> before an identifier such as
<code>lexical-handler</code> or
<code>dom-node</code>. Manage those properties using
<em>setProperty()</em>. Those identifiers are: </p>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr align="center" bgcolor="#ccccff">
<th>Property ID</th>
<th>Description</th>
</tr>
<tr>
<td>declaration-handler</td>
<td> Used to see most DTD declarations except those treated
as lexical ("document element name is ...") or which are
mandatory for all SAX parsers (<em>DTDHandler</em>).
The Object must implement <a href="ext/DeclHandler.html"
><em>org.xml.sax.ext.DeclHandler</em></a>.
</td>
</tr>
<tr>
<td>dom-node</td>
<td> For "DOM Walker" style parsers, which ignore their
<em>parser.parse()</em> parameters, this is used to
specify the DOM (sub)tree being walked by the parser.
The Object must implement the
<em>org.w3c.dom.Node</em> interface.
</td>
</tr>
<tr>
<td>lexical-handler</td>
<td> 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 <a href="ext/LexicalHandler.html"
><em>org.xml.sax.ext.LexicalHandler</em></a>.
</td>
</tr>
<tr>
<td>xml-string</td>
<td> Readable only during a parser callback, this exposes a <b>TBS</b>
chunk of characters responsible for the current event. </td>
</tr>
</table>
<p> All of these standard properties are optional;
XMLReader implementations need not support them.
</p>
</body></html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment