|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.framework.XMLParser
This is the base class of all standard parsers.
Field Summary | |
---|---|
protected DefaultEntityHandler |
fEntityHandler
|
protected XMLErrorReporter |
fErrorReporter
|
protected GrammarResolver |
fGrammarResolver
|
protected boolean |
fParseInProgress
|
protected XMLDocumentScanner |
fScanner
|
protected StringPool |
fStringPool
|
protected XMLValidator |
fValidator
|
protected static java.lang.String |
SAX2_FEATURES_PREFIX
SAX2 features prefix (http://xml.org/sax/features/). |
protected static java.lang.String |
SAX2_PROPERTIES_PREFIX
SAX2 properties prefix (http://xml.org/sax/properties/). |
protected static java.lang.String |
XERCES_FEATURES_PREFIX
Xerces features prefix (http://apache.org/xml/features/). |
protected static java.lang.String |
XERCES_PROPERTIES_PREFIX
Xerces properties prefix (http://apache.org/xml/properties/). |
Fields inherited from interface org.apache.xerces.framework.XMLErrorReporter |
---|
ERRORTYPE_FATAL_ERROR, ERRORTYPE_RECOVERABLE_ERROR, ERRORTYPE_WARNING |
Constructor Summary | |
---|---|
protected |
XMLParser()
Constructor |
protected |
XMLParser(StringPool stringPool)
|
Method Summary | |
---|---|
void |
addRecognizer(XMLDeclRecognizer recognizer)
Adds a recognizer. |
protected boolean |
getAllowJavaEncodings()
Returns true if Java encoding names are allowed in the XML document. |
protected boolean |
getContinueAfterFatalError()
Returns true if the parser continues after a fatal error. |
EntityResolver |
getEntityResolver()
Return the current entity resolver. |
ErrorHandler |
getErrorHandler()
Return the current error handler. |
protected boolean |
getExternalGeneralEntities()
Note: This feature is always true. |
protected boolean |
getExternalParameterEntities()
Note: This feature is always true. |
boolean |
getFeature(java.lang.String featureId)
Query the state of a feature. |
java.lang.String[] |
getFeaturesRecognized()
Returns a list of features that this parser recognizes. |
XMLMessageProvider |
getfgDatatypeMessages()
return the Datatypes Messages object |
XMLMessageProvider |
getfgImplementationMessages()
return the Implementation Messages object |
XMLMessageProvider |
getfgSchemaMessages()
return the Schema Messages object |
XMLMessageProvider |
getfgXMLMessages()
return the XML Messages object |
java.util.Locale |
getfLocale()
return the locale |
protected boolean |
getLoadDTDGrammar()
Returns true if load DTD grammar is turned on in the XMLValiator. |
protected boolean |
getLoadExternalDTD()
Returns true if loading of the external DTD is on. |
Locator |
getLocator()
return the locator being used by the parser |
protected boolean |
getNamespaces()
Returns true if the parser preprocesses namespaces. |
protected boolean |
getNormalizeContents()
|
java.lang.String[] |
getPropertiesRecognized()
Returns a list of properties that this parser recognizes. |
java.lang.Object |
getProperty(java.lang.String propertyId)
Query the value of a property. |
protected boolean |
getValidation()
Returns true if validation is turned on. |
protected boolean |
getValidationDynamic()
Returns true if validation is based on whether a document contains a grammar. |
protected boolean |
getValidationSchema()
Returns true if Schema support is turned on. |
protected boolean |
getValidationSchemaFullChecking()
Returns true if Schema support is turned on. |
protected boolean |
getValidationWarnOnDuplicateAttdef()
Returns true if an error is emitted when an attribute is redefined in the grammar. |
protected boolean |
getValidationWarnOnUndeclaredElemdef()
Returns true if the parser emits an error when an undeclared element is referenced in the grammar. |
protected java.lang.String |
getXMLString()
This method is the equivalent to the property: |
protected void |
initHandlers(boolean sendCharDataAsCharArray,
XMLDocumentHandler docHandler,
XMLDocumentHandler.DTDHandler dtdHandler)
Set char data processing preference and handlers. |
boolean |
isFeatureRecognized(java.lang.String featureId)
Returns true if the specified feature is recognized. |
boolean |
isPropertyRecognized(java.lang.String propertyId)
Returns true if the specified property is recognized. |
void |
parse(InputSource source)
Parses the specified input source. |
void |
parse(java.lang.String systemId)
Parses the input source specified by the given system identifier. |
boolean |
parseSome()
Application-driven parsing. |
boolean |
parseSomeSetup(InputSource source)
Setup for application-driven parsing. |
void |
reportError(Locator locator,
java.lang.String errorDomain,
int majorCode,
int minorCode,
java.lang.Object[] args,
int errorType)
Report an error. |
void |
reset()
Reset parser instance so that it can be reused. |
protected void |
resetOrCopy()
Reset or copy parser Allows parser instance reuse |
protected void |
setAllowJavaEncodings(boolean allow)
Allows the use of Java encoding names in the XMLDecl and TextDecl lines in an XML document. |
protected void |
setContinueAfterFatalError(boolean continueAfterFatalError)
Allows the parser to continue after a fatal error. |
void |
setEntityResolver(EntityResolver resolver)
Sets the resolver used to resolve external entities. |
void |
setErrorHandler(ErrorHandler handler)
Sets the error handler. |
protected void |
setExternalGeneralEntities(boolean expand)
Note: Currently, this parser always expands external general entities. Setting this feature to false will throw a SAXNotSupportedException. |
protected void |
setExternalNoNamespaceSchemaLocation(java.lang.Object value)
Allows the user to set external XML Schema with no target Namespace. |
protected void |
setExternalParameterEntities(boolean expand)
Note: Currently, this parser always expands external parameter entities. Setting this feature to false will throw a SAXNotSupportedException. |
protected void |
setExternalSchemaLocation(java.lang.Object value)
Allows the user to set a list of external XML Schemas (ex."http://example.com schema.xsd") to be used by the parser. |
void |
setFeature(java.lang.String featureId,
boolean state)
Set the state of a feature. |
protected void |
setLoadDTDGrammar(boolean loadDTDGrammar)
Allows the parser to have the choice to load DTD grammar when validation is off. |
protected void |
setLoadExternalDTD(boolean loadExternalDTD)
Allows the parser to have the choice to load the external DTD when validation is off. |
void |
setLocale(java.util.Locale locale)
Set the locale to use for messages. |
protected void |
setNamespaces(boolean process)
Sets whether the parser preprocesses namespaces. |
protected void |
setNormalizeAttributeValues(boolean normalize)
|
protected void |
setNormalizeContents(boolean normalize)
Normalization of element content is controlled by this feature. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object value)
Set the value of a property. |
void |
setReaderFactory(XMLEntityReaderFactory readerFactory)
Set the reader factory. |
protected void |
setValidation(boolean validate)
Sets whether the parser validates. |
protected void |
setValidationDynamic(boolean dynamic)
Allows the parser to validate a document only when it contains a grammar. |
protected void |
setValidationSchema(boolean schema)
Allows the user to turn Schema support on/off. |
protected void |
setValidationSchemaFullChecking(boolean schemaFullChecking)
Allows the user to turn full Schema constraint checking on/off. |
protected void |
setValidationWarnOnDuplicateAttdef(boolean warn)
Sets whether an error is emitted when an attribute is redefined in the grammar. |
protected void |
setValidationWarnOnUndeclaredElemdef(boolean warn)
Sets whether the parser emits an error when an element's content model references an element by name that is not declared in the grammar. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.xerces.framework.XMLDocumentHandler.DTDHandler |
---|
attlistDecl, comment, elementDecl, endDTD, externalEntityDecl, externalPEDecl, internalEntityDecl, internalPEDecl, internalSubset, notationDecl, processingInstruction, startDTD, textDecl, unparsedEntityDecl |
Field Detail |
protected static final java.lang.String SAX2_FEATURES_PREFIX
protected static final java.lang.String SAX2_PROPERTIES_PREFIX
protected static final java.lang.String XERCES_FEATURES_PREFIX
protected static final java.lang.String XERCES_PROPERTIES_PREFIX
protected GrammarResolver fGrammarResolver
protected boolean fParseInProgress
protected StringPool fStringPool
protected XMLErrorReporter fErrorReporter
protected DefaultEntityHandler fEntityHandler
protected XMLDocumentScanner fScanner
protected XMLValidator fValidator
Constructor Detail |
protected XMLParser()
protected XMLParser(StringPool stringPool)
Method Detail |
protected void initHandlers(boolean sendCharDataAsCharArray, XMLDocumentHandler docHandler, XMLDocumentHandler.DTDHandler dtdHandler)
public java.lang.String[] getFeaturesRecognized()
isFeatureRecognized(java.lang.String)
,
setFeature(java.lang.String, boolean)
,
getFeature(java.lang.String)
public boolean isFeatureRecognized(java.lang.String featureId)
getFeaturesRecognized()
,
setFeature(java.lang.String, boolean)
,
getFeature(java.lang.String)
public java.lang.String[] getPropertiesRecognized()
isPropertyRecognized(java.lang.String)
,
setProperty(java.lang.String, java.lang.Object)
,
getProperty(java.lang.String)
public boolean isPropertyRecognized(java.lang.String propertyId)
getPropertiesRecognized()
,
setProperty(java.lang.String, java.lang.Object)
,
getProperty(java.lang.String)
public boolean parseSomeSetup(InputSource source) throws java.lang.Exception
source
- the input source to be parsed.parseSome()
public boolean parseSome() throws java.lang.Exception
parseSomeSetup(org.xml.sax.InputSource)
public void reset() throws java.lang.Exception
public final Locator getLocator()
getLocator
in interface XMLErrorReporter
public final java.util.Locale getfLocale()
public final XMLMessageProvider getfgXMLMessages()
public final XMLMessageProvider getfgImplementationMessages()
public final XMLMessageProvider getfgSchemaMessages()
public final XMLMessageProvider getfgDatatypeMessages()
public void setReaderFactory(XMLEntityReaderFactory readerFactory)
public void addRecognizer(XMLDeclRecognizer recognizer)
recognizer
- The XML recognizer to add.protected void setValidation(boolean validate) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://xml.org/sax/features/validation
validate
- True to validate; false to not validate.getValidation()
,
setFeature(java.lang.String, boolean)
protected boolean getValidation() throws SAXNotRecognizedException, SAXNotSupportedException
setValidation(boolean)
protected void setExternalGeneralEntities(boolean expand) throws SAXNotRecognizedException, SAXNotSupportedException
Sets whether external general entities are expanded.
This method is the equivalent to the feature:
http://xml.org/sax/features/external-general-entities
expand
- True to expand external general entities; false
to not expand.getExternalGeneralEntities()
,
setFeature(java.lang.String, boolean)
protected boolean getExternalGeneralEntities() throws SAXNotRecognizedException, SAXNotSupportedException
Returns true if external general entities are expanded.
setExternalGeneralEntities(boolean)
protected void setExternalParameterEntities(boolean expand) throws SAXNotRecognizedException, SAXNotSupportedException
Sets whether external parameter entities are expanded.
This method is the equivalent to the feature:
http://xml.org/sax/features/external-parameter-entities
expand
- True to expand external parameter entities; false
to not expand.getExternalParameterEntities()
,
setFeature(java.lang.String, boolean)
protected boolean getExternalParameterEntities() throws SAXNotRecognizedException, SAXNotSupportedException
Returns true if external parameter entities are expanded.
setExternalParameterEntities(boolean)
protected void setNamespaces(boolean process) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://xml.org/sax/features/namespaces
process
- True to process namespaces; false to not process.getNamespaces()
,
setFeature(java.lang.String, boolean)
protected boolean getNamespaces() throws SAXNotRecognizedException, SAXNotSupportedException
setNamespaces(boolean)
protected void setValidationSchema(boolean schema) throws SAXNotRecognizedException, SAXNotSupportedException
This method is equivalent to the feature:
http://apache.org/xml/features/validation/schema
schema
- True to turn on Schema support; false to turn it off.getValidationSchema()
,
setFeature(java.lang.String, boolean)
protected boolean getValidationSchema() throws SAXNotRecognizedException, SAXNotSupportedException
setValidationSchema(boolean)
protected void setValidationSchemaFullChecking(boolean schemaFullChecking) throws SAXNotRecognizedException, SAXNotSupportedException
This method is equivalent to the feature:
http://apache.org/xml/features/validation/schema-full-checking
schemaFullChecking
- True to turn on full schema constraint checking.getValidationSchemaFullChecking()
,
setFeature(java.lang.String, boolean)
protected void setNormalizeContents(boolean normalize)
normalize
- protected boolean getNormalizeContents()
protected void setExternalSchemaLocation(java.lang.Object value) throws SAXNotRecognizedException, SAXNotSupportedException
This method is equivalent to the property:
http://apache.org/xml/properties/schema/external-schemaLocation
value
- The list of schemas.SAXNotRecognizedException
- SAXNotSupportedException
- protected void setExternalNoNamespaceSchemaLocation(java.lang.Object value) throws SAXNotRecognizedException, SAXNotSupportedException
This method is equivalent to the property:
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
value
- An XML Schema file nameSAXNotRecognizedException
- SAXNotSupportedException
- protected boolean getValidationSchemaFullChecking() throws SAXNotRecognizedException, SAXNotSupportedException
setValidationSchemaFullChecking(boolean)
protected void setValidationDynamic(boolean dynamic) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://apache.org/xml/features/validation/dynamic
dynamic
- True to dynamically validate documents; false to
validate based on the validation feature.getValidationDynamic()
,
setFeature(java.lang.String, boolean)
protected boolean getValidationDynamic() throws SAXNotRecognizedException, SAXNotSupportedException
setValidationDynamic(boolean)
protected void setNormalizeAttributeValues(boolean normalize)
protected void setLoadDTDGrammar(boolean loadDTDGrammar) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://apache.org/xml/features/nonvalidating/load-dtd-grammar
loadDTDGrammar
- True to turn on the feature; false to
turn off the feature.getLoadDTDGrammar()
,
setFeature(java.lang.String, boolean)
protected boolean getLoadDTDGrammar() throws SAXNotRecognizedException, SAXNotSupportedException
setLoadDTDGrammar(boolean)
protected void setLoadExternalDTD(boolean loadExternalDTD) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://apache.org/xml/features/nonvalidating/load-external-dtd
loadExternalDTD
- True to turn on the feature; false to
turn off the feature.getLoadExternalDTD()
,
setFeature(java.lang.String, boolean)
protected boolean getLoadExternalDTD() throws SAXNotRecognizedException, SAXNotSupportedException
setLoadExternalDTD(boolean)
protected void setValidationWarnOnDuplicateAttdef(boolean warn) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://apache.org/xml/features/validation/warn-on-duplicate-attdef
warn
- True to warn; false to not warn.getValidationWarnOnDuplicateAttdef()
,
setFeature(java.lang.String, boolean)
protected boolean getValidationWarnOnDuplicateAttdef() throws SAXNotRecognizedException, SAXNotSupportedException
setValidationWarnOnDuplicateAttdef(boolean)
protected void setValidationWarnOnUndeclaredElemdef(boolean warn) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://apache.org/xml/features/validation/warn-on-undeclared-elemdef
warn
- True to warn; false to not warn.getValidationWarnOnUndeclaredElemdef()
,
setFeature(java.lang.String, boolean)
protected boolean getValidationWarnOnUndeclaredElemdef() throws SAXNotRecognizedException, SAXNotSupportedException
setValidationWarnOnUndeclaredElemdef(boolean)
protected void setAllowJavaEncodings(boolean allow) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://apache.org/xml/features/allow-java-encodings
allow
- True to allow Java encoding names; false to disallow.getAllowJavaEncodings()
,
setFeature(java.lang.String, boolean)
protected boolean getAllowJavaEncodings() throws SAXNotRecognizedException, SAXNotSupportedException
setAllowJavaEncodings(boolean)
protected void setContinueAfterFatalError(boolean continueAfterFatalError) throws SAXNotRecognizedException, SAXNotSupportedException
This method is the equivalent to the feature:
http://apache.org/xml/features/continue-after-fatal-error
continueAfterFatalError
- True to continue; false to stop on
fatal error.getContinueAfterFatalError()
,
setFeature(java.lang.String, boolean)
protected boolean getContinueAfterFatalError() throws SAXNotRecognizedException, SAXNotSupportedException
setContinueAfterFatalError(boolean)
protected java.lang.String getXMLString() throws SAXNotRecognizedException, SAXNotSupportedException
http://xml.org/sax/properties/xml-string
getProperty(java.lang.String)
protected void resetOrCopy() throws java.lang.Exception
public void setEntityResolver(EntityResolver resolver)
resolver
- The new entity resolver. Passing a null value will
uninstall the currently installed resolver.public EntityResolver getEntityResolver()
setEntityResolver(org.xml.sax.EntityResolver)
public void setErrorHandler(ErrorHandler handler)
handler
- The new error handler.public ErrorHandler getErrorHandler()
setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(InputSource source) throws SAXException, java.io.IOException
source
- The input source.SAXException
- Throws exception on SAX error.java.io.IOException
- Throws exception on i/o error.public void parse(java.lang.String systemId) throws SAXException, java.io.IOException
This method is almost equivalent to the following:
parse(new InputSource(systemId));The only difference is that this method will attempt to close the stream that was opened.
source
- The input source.SAXException
- Throws exception on SAX error.java.io.IOException
- Throws exception on i/o error.public void setLocale(java.util.Locale locale) throws SAXException
locale
- The locale object to use for localization of messages.SAXException
- An exception thrown if the parser does not
support the specified locale.Parser
public void reportError(Locator locator, java.lang.String errorDomain, int majorCode, int minorCode, java.lang.Object[] args, int errorType) throws java.lang.Exception
reportError
in interface XMLErrorReporter
locator
- Location of error.errorDomain
- The error domain.majorCode
- The major code of the error.minorCode
- The minor code of the error.args
- Arguments for replacement text.errorType
- The type of the error.java.lang.Exception
- Thrown on error.XMLErrorReporter.ERRORTYPE_WARNING
,
XMLErrorReporter.ERRORTYPE_FATAL_ERROR
public void setFeature(java.lang.String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException
featureId
- The unique identifier (URI) of the feature.state
- The requested state of the feature (true or false).SAXNotRecognizedException
- If the
requested feature is not known.SAXNotSupportedException
- If the
requested feature is known, but the requested
state is not supported.SAXException
- If there is any other
problem fulfilling the request.public boolean getFeature(java.lang.String featureId) throws SAXNotRecognizedException, SAXNotSupportedException
featureId
- The unique identifier (URI) of the feature
being set.SAXNotRecognizedException
- If the
requested feature is not known.SAXException
- If there is any other
problem fulfilling the request.public void setProperty(java.lang.String propertyId, java.lang.Object value) throws SAXNotRecognizedException, SAXNotSupportedException
propertyId
- The unique identifier (URI) of the property
being set.Object
- The value to which the property is being set.SAXNotRecognizedException
- If the
requested property is not known.SAXNotSupportedException
- If the
requested property is known, but the requested
value is not supported.SAXException
- If there is any other
problem fulfilling the request.public java.lang.Object getProperty(java.lang.String propertyId) throws SAXNotRecognizedException, SAXNotSupportedException
propertyId
- The unique identifier (URI) of the property
being set.SAXNotRecognizedException
- If the
requested property is not known.SAXException
- If there is any other
problem fulfilling the request.XMLReader.getProperty(java.lang.String)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |