|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.brownell.xml.Parser2
This is a wrapper around the com.sun.xml.parser.* SAX1 parsers, implementing SAX2 interfaces. The standardized SAX2 facilities exposed by this parser include all SAX1 features, as well as a number of additional features and properties identified by standardized URIs. Those features are summarized below.
Name | Notes |
---|---|
(URI)/external-general-entities | Value is fixed at true |
(URI)/external-parameter-entities | Value is fixed at true |
(URI)/namespaces | Value is fixed at false (temporary -- SAX2 demands default of 'true') |
(URI)/namespace-prefixes | Value is fixed at true (temporary -- SAX2 demands default of 'false') |
(URI)/string-interning | Value is fixed at true |
(URI)/validation | Defaults to false; may be set to true |
(URI)/declaration-handler | A declaration handler may be provided. Declaration of general entities is exposed, but not parameter entities; none of the entity names reported here will begin with "%". |
(URI)/lexical-handler | A lexical handler may be provided. While the start and end of any external subset are reported, expansion of other parameter entities (e.g. inside attribute list declarations) is not exposed. Expansion of general entities within attributes is also not exposed (see below). |
Other features of the Sun parser, some of which may be significant by their current lack of support in SAX2, include:
Expansion of entities is not exposed, although the final version of SAX2 does now address the reporting issues noted in response to the implementation of the first (1998) SAX2 API proposals.
Constructor Summary | |
Parser2()
Constructs an unitialized SAX2 parser. |
Method Summary | |
ContentHandler |
getContentHandler()
SAX2: Returns the object used to report the logical content of an XML document. |
DTDHandler |
getDTDHandler()
SAX2: Returns the object used to process declarations related to notations and unparsed entities. |
EntityResolver |
getEntityResolver()
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities). |
ErrorHandler |
getErrorHandler()
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning). |
boolean |
getFeature(java.lang.String featureId)
SAX2: Tells whether this parser supports the specified feature. |
java.lang.Object |
getProperty(java.lang.String propertyId)
SAX2: Returns the specified property. |
void |
parse(InputSource input)
SAX1: parse the XML text in the given input source. |
void |
parse(java.lang.String uri)
SAX1: Parse the XML text at the given input URI. |
void |
setContentHandler(ContentHandler handler)
SAX2: Assigns the object used to report the logical content of an XML document. |
void |
setDTDHandler(DTDHandler handler)
SAX1: Provides an object which may be used to intercept declarations related to notations and unparsed entities. |
void |
setEntityResolver(EntityResolver resolver)
SAX1: Provides an object which may be used when resolving external entities during parsing (both general and parameter entities). |
void |
setErrorHandler(ErrorHandler handler)
SAX1: Provides an object which receives callbacks for XML errors of all levels (fatal, nonfatal, warning). |
void |
setFeature(java.lang.String featureId,
boolean state)
SAX2: Sets the state of features supported in this parser. |
void |
setLocale(java.util.Locale locale)
SAX1: Identifies the locale which the parser should use for the diagnostics it provides. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object property)
SAX2: Assigns the specified property. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Parser2()
Method Detail |
public ErrorHandler getErrorHandler()
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
public void setErrorHandler(ErrorHandler handler)
NOTE: When using a validating parser, the SAX default error handler almost certainly does not do what you expected. Unless you specified validation on a lark, you probably wanted to do something more with validity errors than discard them. You should provide a handler which does something useful with nonfatal errors, probably reporting them (perhaps by treating them like fatal errors).
handler
- The error handler.XMLReader.getErrorHandler()
public ContentHandler getContentHandler()
XMLReader.setContentHandler(org.xml.sax.ContentHandler)
public void setContentHandler(ContentHandler handler)
handler
- The content handler.XMLReader.getContentHandler()
public DTDHandler getDTDHandler()
XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
public void setDTDHandler(DTDHandler handler)
handler
- The DTD handler.XMLReader.getDTDHandler()
public EntityResolver getEntityResolver()
XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
public void setEntityResolver(EntityResolver resolver)
resolver
- The entity resolver.XMLReader.getEntityResolver()
public void setLocale(java.util.Locale locale) throws SAXException
public void parse(java.lang.String uri) throws SAXException, java.io.IOException
public void parse(InputSource input) throws SAXException, java.io.IOException
public boolean getFeature(java.lang.String featureId) throws SAXNotRecognizedException, SAXNotSupportedException
name
- The feature name, which is a fully-qualified URI.XMLReader.setFeature(java.lang.String, boolean)
public java.lang.Object getProperty(java.lang.String propertyId) throws SAXNotRecognizedException, SAXNotSupportedException
name
- The property name, which is a fully-qualified URI.XMLReader.setProperty(java.lang.String, java.lang.Object)
public void setFeature(java.lang.String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException
name
- The feature name, which is a fully-qualified URI.state
- The requested state of the feature (true or false).XMLReader.getFeature(java.lang.String)
public void setProperty(java.lang.String propertyId, java.lang.Object property) throws SAXNotRecognizedException, SAXNotSupportedException
name
- The property name, which is a fully-qualified URI.state
- The requested value for the property.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |