|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
oracle.xml.parser.v2.XMLParser | +--oracle.xml.parser.v2.SAXParser
This class implements an eXtensible Markup Language (XML) 1.0 SAX parser according to the World Wide Web Consortium (W3C) recommendation. Applications can register a SAX handler to receive notification of various parser events.
XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse.
All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.
This interface replaces the (now deprecated) SAX 1.0 Parser interface. The XMLReader interface contains two important enhancements over the old Parser interface:
Fields inherited from class oracle.xml.parser.v2.XMLParser |
attributes,
BASE_URL,
DTD_OBJECT,
SCHEMA_OBJECT,
STANDALONE,
USE_DTD_ONLY_FOR_VALIDATION |
Constructor Summary |
SAXParser()
Creates a new parser object. |
Method Summary |
Type | Method |
---|---|
ContentHandler |
getContentHandler()
Return the current content handler. |
DTDHandler |
getDTDHandler()
Return the current DTD handler. |
boolean |
getFeature(java.lang.String name)
Look up the value of a feature. |
java.lang.Object |
getProperty(java.lang.String name)
Look up the value of a property. |
void |
setContentHandler(ContentHandler handler)
Allow an application to register a content event handler. |
void |
setDocumentHandler(DocumentHandler handler)
Deprecated. as of SAX2.0 - Replaced by setContentHandler |
void |
setDTDHandler(DTDHandler handler)
Allow an application to register a DTD event handler. |
void |
setFeature(java.lang.String name,
boolean value)
Set the state of a feature. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Set the value of a property. |
Methods inherited from class oracle.xml.parser.v2.XMLParser |
getAttribute,
getBaseURL,
getCompatibilityVersion,
getEntityResolver,
getErrorHandler,
getReleaseVersion,
getValidationMode,
getValidationModeValue,
getXMLProperty,
isXMLPropertyReadOnly,
isXMLPropertySupported,
parse,
parse,
parse,
parse,
parse,
reset,
setAttribute,
setBaseURL,
setDoctype,
setEntityResolver,
setErrorHandler,
setLocale,
setPreserveWhitespace,
setSchemaValidationMode,
setValidationMode,
setValidationMode,
setXMLProperty,
setXMLSchema |
Constructor Detail |
public SAXParser()
Method Detail |
public void setDocumentHandler(DocumentHandler handler)
handler
- DocumentHandler
being registeredParser.setDocumentHandler(org.xml.sax.DocumentHandler)
,
DocumentHandler
public boolean getFeature(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException
The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but 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:
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."); }
The feature "http://xml.org/sax/features/validation" due to its binary input value only controls DTD validation. The value true sets DTD validation to TRUE. This feature cannot be used to control XML Schema based validation
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.setFeature(java.lang.String, boolean)
public void setFeature(java.lang.String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
The feature name is any fully-qualified URI. It is
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 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.
The feature "http://xml.org/sax/features/validation" due to its binary input value only controls DTD validation. The value true sets DTD validation to TRUE. This feature cannot be used to control XML Schema based validation
name
- The feature name, which is a fully-qualified URI.state
- The requested state of the feature (true or false).getFeature(java.lang.String)
public java.lang.Object getProperty(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException
The property name is any fully-qualified URI. It is
possible for an XMLReader to recognize a property name but
to be unable to return its state; this is especially true
in the case of an adapter for a SAX1 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.
name
- The property name, which is a fully-qualified URI.setProperty(java.lang.String, java.lang.Object)
public void setProperty(java.lang.String name, java.lang.Object value) throws SAXNotRecognizedException, SAXNotSupportedException
The property name is any fully-qualified URI. It is
possible for an XMLReader to recognize a property name but
to be unable to set its value; this is especially true
in the case of an adapter for a SAX1 Parser
.
XMLReaders are not required to recognize setting 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.
name
- The property name, which is a fully-qualified URI.state
- The requested value for the property.public void setDTDHandler(DTDHandler 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.getDTDHandler()
public DTDHandler getDTDHandler()
setDTDHandler(org.xml.sax.DTDHandler)
public void setContentHandler(ContentHandler 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.getContentHandler()
public ContentHandler getContentHandler()
setContentHandler(org.xml.sax.ContentHandler)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |