Javolution 6.0.0 java
|
Classes | |
class | Proxy |
class | Sax2DefaultHandler |
Public Member Functions | |
SAX2ReaderImpl () | |
boolean | getFeature (String name) throws SAXNotRecognizedException, SAXNotSupportedException |
void | setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException |
Object | getProperty (String name) throws SAXNotRecognizedException, SAXNotSupportedException |
void | setProperty (String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException |
void | setEntityResolver (EntityResolver resolver) |
EntityResolver | getEntityResolver () |
void | setDTDHandler (DTDHandler handler) |
DTDHandler | getDTDHandler () |
void | setContentHandler (ContentHandler handler) |
ContentHandler | getContentHandler () |
void | setErrorHandler (ErrorHandler handler) |
ErrorHandler | getErrorHandler () |
void | parse (InputSource input) throws IOException, SAXException |
void | parse (String systemId) throws IOException, SAXException |
void | reset () |
Static Private Member Functions | |
static CharSequence | toCharSequence (Object obj) |
Private Attributes | |
final XMLReaderImpl | _parser = new XMLReaderImpl() |
final Proxy | _proxy = new Proxy() |
Static Private Attributes | |
static Sax2DefaultHandler | DEFAULT_HANDLER = new Sax2DefaultHandler() |
This class provides a SAX2-compliant parser wrapping a javolution.xml.sax.XMLReaderImpl. This parser allocates java.lang.String
instances while parsing in accordance with the SAX2 specification. For faster performance (2-5x), the use of the SAX2-like XMLSaxParserImpl or betterXMLStreamReader is recommended.
Definition at line 43 of file SAX2ReaderImpl.java.
javolution.xml.sax.SAX2ReaderImpl.SAX2ReaderImpl | ( | ) |
ContentHandler javolution.xml.sax.SAX2ReaderImpl.getContentHandler | ( | ) |
Return the current content handler.
Implements javolution.xml.sax.XMLReader.
Definition at line 120 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._proxy, javolution.xml.sax.SAX2ReaderImpl.Proxy._sax2Handler, and javolution.xml.sax.SAX2ReaderImpl.DEFAULT_HANDLER.
DTDHandler javolution.xml.sax.SAX2ReaderImpl.getDTDHandler | ( | ) |
Return the current DTD handler.
Implements javolution.xml.sax.XMLReader.
Definition at line 105 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.getDTDHandler().
EntityResolver javolution.xml.sax.SAX2ReaderImpl.getEntityResolver | ( | ) |
Return the current entity resolver.
Implements javolution.xml.sax.XMLReader.
Definition at line 95 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.getEntityResolver().
ErrorHandler javolution.xml.sax.SAX2ReaderImpl.getErrorHandler | ( | ) |
Return the current error handler.
Implements javolution.xml.sax.XMLReader.
Definition at line 131 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.getErrorHandler().
boolean javolution.xml.sax.SAX2ReaderImpl.getFeature | ( | String | name | ) | throws SAXNotRecognizedException, SAXNotSupportedException |
Look up the value of a feature flag.
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 org.xml.sax.Parser, there is no implementation-independent way to expose whether the underlying parser is performing validation, expanding external entities, and so forth.)
All XMLReaders are required to recognize the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes feature names.
Typical usage is something like this:
XMLReader r = new MySAXDriver();
// try to activate validation try { r.setFeature("http://xml.org/sax/features/validation", true); } catch (SAXException e) { System.err.println("Cannot activate validation."); }
// register event handlers r.setContentHandler(new MyContentHandler()); r.setErrorHandler(new MyErrorHandler());
// parse the first document try { r.parse("http://www.foo.com/mydoc.xml"); } catch (IOException e) { System.err.println("I/O exception reading XML document"); } catch (SAXException e) { System.err.println("XML exception reading document."); }
Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.
name | The feature name, which is a fully-qualified URI. |
org.xml.sax.SAXNotRecognizedException | If the feature value can't be assigned or retrieved. |
org.xml.sax.SAXNotSupportedException | When the XMLReader recognizes the feature name but cannot determine its value at this time. |
Implements javolution.xml.sax.XMLReader.
Definition at line 66 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.getFeature().
Object javolution.xml.sax.SAX2ReaderImpl.getProperty | ( | String | name | ) | throws SAXNotRecognizedException, SAXNotSupportedException |
Look up the value of a property.
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.
XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2.
Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.
name | The property name, which is a fully-qualified URI. |
org.xml.sax.SAXNotRecognizedException | If the property value can't be assigned or retrieved. |
org.xml.sax.SAXNotSupportedException | When the XMLReader recognizes the property name but cannot determine its value at this time. |
Implements javolution.xml.sax.XMLReader.
Definition at line 78 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.getProperty().
void javolution.xml.sax.SAX2ReaderImpl.parse | ( | InputSource | input | ) | throws IOException, SAXException |
Parse an XML document.
The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI).
Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source. Configuration of the XMLReader object (such as handler bindings and values established for feature flags and properties) is unchanged by completion of a parse, unless the definition of that aspect of the configuration explicitly specifies other behavior. (For example, feature flags or properties exposing characteristics of the document being parsed.)
During the parse, the XMLReader will provide information about the XML document through the registered event handlers.
This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.
input | The input source for the top-level of the XML document. |
org.xml.sax.SAXException | Any SAX exception, possibly wrapping another exception. |
j2me.io.IOException | An IO exception from the parser, possibly from a byte stream or character stream supplied by the application. |
Implements javolution.xml.sax.XMLReader.
Definition at line 136 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, javolution.xml.sax.XMLReaderImpl.parse(), and javolution.xml.sax.XMLReaderImpl.reset().
void javolution.xml.sax.SAX2ReaderImpl.parse | ( | String | systemId | ) | throws IOException, SAXException |
Parse an XML document from a system identifier (URI).
This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following:
parse(new InputSource(systemId));
If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser.
systemId | The system identifier (URI). |
org.xml.sax.SAXException | Any SAX exception, possibly wrapping another exception. |
j2me.io.IOException | An IO exception from the parser, possibly from a byte stream or character stream supplied by the application. |
Implements javolution.xml.sax.XMLReader.
Definition at line 145 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, javolution.xml.sax.XMLReaderImpl.parse(), and javolution.xml.sax.XMLReaderImpl.reset().
void javolution.xml.sax.SAX2ReaderImpl.reset | ( | ) |
Definition at line 154 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.reset().
void javolution.xml.sax.SAX2ReaderImpl.setContentHandler | ( | ContentHandler | handler | ) |
Allow an application to register a content event handler.
If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler | The content handler. |
Implements javolution.xml.sax.XMLReader.
Definition at line 110 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, javolution.xml.sax.SAX2ReaderImpl._proxy, javolution.xml.sax.SAX2ReaderImpl.Proxy._sax2Handler, and javolution.xml.sax.XMLReaderImpl.setContentHandler().
void javolution.xml.sax.SAX2ReaderImpl.setDTDHandler | ( | DTDHandler | handler | ) |
Allow an application to register a DTD event handler.
If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler | The DTD handler. |
Implements javolution.xml.sax.XMLReader.
Definition at line 100 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.setDTDHandler().
void javolution.xml.sax.SAX2ReaderImpl.setEntityResolver | ( | EntityResolver | resolver | ) |
Allow an application to register an entity resolver.
If the application does not register an entity resolver, the XMLReader will perform its own default resolution.
Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.
resolver | The entity resolver. |
Implements javolution.xml.sax.XMLReader.
Definition at line 90 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.setEntityResolver().
void javolution.xml.sax.SAX2ReaderImpl.setErrorHandler | ( | ErrorHandler | handler | ) |
Allow an application to register an error event handler.
If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler | The error handler. |
Implements javolution.xml.sax.XMLReader.
Definition at line 126 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.setErrorHandler().
void javolution.xml.sax.SAX2ReaderImpl.setFeature | ( | String | name, |
boolean | value | ||
) | throws SAXNotRecognizedException, SAXNotSupportedException |
Set the value of a feature flag.
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.
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.
name | The feature name, which is a fully-qualified URI. |
value | The requested value of the feature (true or false). |
org.xml.sax.SAXNotRecognizedException | If the feature value can't be assigned or retrieved. |
org.xml.sax.SAXNotSupportedException | When the XMLReader recognizes the feature name but cannot set the requested value. |
Implements javolution.xml.sax.XMLReader.
Definition at line 72 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.setFeature().
void javolution.xml.sax.SAX2ReaderImpl.setProperty | ( | String | name, |
Object | value | ||
) | throws SAXNotRecognizedException, SAXNotSupportedException |
Set the value of a property.
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.
XMLReaders are not required to recognize setting any specific property names, though a core set is defined by SAX2.
This method is also the standard mechanism for setting extended handlers.
name | The property name, which is a fully-qualified URI. |
value | The requested value for the property. |
org.xml.sax.SAXNotRecognizedException | If the property value can't be assigned or retrieved. |
org.xml.sax.SAXNotSupportedException | When the XMLReader recognizes the property name but cannot set the requested value. |
Implements javolution.xml.sax.XMLReader.
Definition at line 84 of file SAX2ReaderImpl.java.
References javolution.xml.sax.SAX2ReaderImpl._parser, and javolution.xml.sax.XMLReaderImpl.setProperty().
|
staticprivate |
Definition at line 381 of file SAX2ReaderImpl.java.
Referenced by javolution.xml.sax.SAX2ReaderImpl.Proxy.getIndex(), javolution.xml.sax.SAX2ReaderImpl.Proxy.getType(), and javolution.xml.sax.SAX2ReaderImpl.Proxy.getValue().
|
private |
Holds the real-time parser instance associated to this SAX2 parser.
Definition at line 53 of file SAX2ReaderImpl.java.
Referenced by javolution.xml.sax.SAX2ReaderImpl.getDTDHandler(), javolution.xml.sax.SAX2ReaderImpl.getEntityResolver(), javolution.xml.sax.SAX2ReaderImpl.getErrorHandler(), javolution.xml.sax.SAX2ReaderImpl.getFeature(), javolution.xml.sax.SAX2ReaderImpl.getProperty(), javolution.xml.sax.SAX2ReaderImpl.parse(), javolution.xml.sax.SAX2ReaderImpl.reset(), javolution.xml.sax.SAX2ReaderImpl.setContentHandler(), javolution.xml.sax.SAX2ReaderImpl.setDTDHandler(), javolution.xml.sax.SAX2ReaderImpl.setEntityResolver(), javolution.xml.sax.SAX2ReaderImpl.setErrorHandler(), javolution.xml.sax.SAX2ReaderImpl.setFeature(), and javolution.xml.sax.SAX2ReaderImpl.setProperty().
Holds the content handler proxy.
Definition at line 58 of file SAX2ReaderImpl.java.
Referenced by javolution.xml.sax.SAX2ReaderImpl.getContentHandler(), and javolution.xml.sax.SAX2ReaderImpl.setContentHandler().
|
staticprivate |
Holds the SAX2 default handler instance.
Definition at line 48 of file SAX2ReaderImpl.java.
Referenced by javolution.xml.sax.SAX2ReaderImpl.Proxy.endDocument(), and javolution.xml.sax.SAX2ReaderImpl.getContentHandler().