|
|||||||||
| Home >> All >> org >> apache >> xerces >> [ framework overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.xerces.framework
Class XMLParser

java.lang.Objectorg.apache.xerces.framework.XMLParser
- All Implemented Interfaces:
- XMLDocumentHandler.DTDHandler, XMLErrorReporter
- public abstract class XMLParser
- extends java.lang.Object
- implements XMLErrorReporter, XMLDocumentHandler.DTDHandler
- extends java.lang.Object
This is the base class of all standard parsers.
- Version:
- $Id: XMLParser.java,v 1.4 2000/10/07 18:06:53 markd Exp $
| Fields inherited from interface org.apache.xerces.framework.XMLErrorReporter |
ERRORTYPE_FATAL_ERROR, ERRORTYPE_RECOVERABLE_ERROR, ERRORTYPE_WARNING |
| Constructor Summary | |
protected |
XMLParser()
Constructor |
| Method Summary | |
void |
addRecognizer(org.apache.xerces.readers.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. |
org.xml.sax.EntityResolver |
getEntityResolver()
Return the current entity resolver. |
org.xml.sax.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. |
protected boolean |
getLoadDTDGrammar()
Returns true if load DTD grammar is turned on in the XMLValiator. |
org.xml.sax.Locator |
getLocator()
return the locator being used by the parser |
protected boolean |
getNamespaces()
Returns true if the parser preprocesses namespaces. |
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 |
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(org.xml.sax.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(org.xml.sax.InputSource source)
Setup for application-driven parsing. |
void |
reportError(org.xml.sax.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(org.xml.sax.EntityResolver resolver)
Sets the resolver used to resolve external entities. |
void |
setErrorHandler(org.xml.sax.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 |
setExternalParameterEntities(boolean expand)
Note: Currently, this parser always expands external parameter entities. Setting this feature to false will throw a SAXNotSupportedException. |
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. |
void |
setLocale(java.util.Locale locale)
Set the locale to use for messages. |
protected void |
setNamespaces(boolean process)
Sets whether the parser preprocesses namespaces. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object value)
Set the value of a property. |
void |
setReaderFactory(org.apache.xerces.readers.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 |
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 |
SAX2_FEATURES_PREFIX
protected static final java.lang.String SAX2_FEATURES_PREFIX
- SAX2 features prefix (http://xml.org/sax/features/).
- See Also:
- Constant Field Values
SAX2_PROPERTIES_PREFIX
protected static final java.lang.String SAX2_PROPERTIES_PREFIX
- SAX2 properties prefix (http://xml.org/sax/properties/).
- See Also:
- Constant Field Values
XERCES_FEATURES_PREFIX
protected static final java.lang.String XERCES_FEATURES_PREFIX
- Xerces features prefix (http://apache.org/xml/features/).
- See Also:
- Constant Field Values
XERCES_PROPERTIES_PREFIX
protected static final java.lang.String XERCES_PROPERTIES_PREFIX
- Xerces properties prefix (http://apache.org/xml/properties/).
- See Also:
- Constant Field Values
RECOGNIZED_FEATURES
private static final java.lang.String[] RECOGNIZED_FEATURES
- Features recognized by this parser.
RECOGNIZED_PROPERTIES
private static final java.lang.String[] RECOGNIZED_PROPERTIES
- Properties recognized by this parser.
PRINT_EXCEPTION_STACK_TRACE
private static final boolean PRINT_EXCEPTION_STACK_TRACE
- Set to true and recompile to print exception stack trace.
- See Also:
- Constant Field Values
fGrammarResolver
protected org.apache.xerces.validators.common.GrammarResolver fGrammarResolver
fParseInProgress
protected boolean fParseInProgress
fNeedReset
private boolean fNeedReset
fContinueAfterFatalError
private boolean fContinueAfterFatalError
- Continue after fatal error.
fErrorHandler
private org.xml.sax.ErrorHandler fErrorHandler
- Error handler.
fLocale
private java.util.Locale fLocale
fgXMLMessages
private static org.apache.xerces.utils.XMLMessageProvider fgXMLMessages
fgImplementationMessages
private static org.apache.xerces.utils.XMLMessageProvider fgImplementationMessages
fgSchemaMessages
private static org.apache.xerces.utils.XMLMessageProvider fgSchemaMessages
fgDatatypeMessages
private static org.apache.xerces.utils.XMLMessageProvider fgDatatypeMessages
fStringPool
protected org.apache.xerces.utils.StringPool fStringPool
fErrorReporter
protected XMLErrorReporter fErrorReporter
fEntityHandler
protected org.apache.xerces.readers.DefaultEntityHandler fEntityHandler
fScanner
protected XMLDocumentScanner fScanner
fValidator
protected org.apache.xerces.validators.common.XMLValidator fValidator
| Constructor Detail |
XMLParser
protected XMLParser()
- Constructor
| Method Detail |
initHandlers
protected void initHandlers(boolean sendCharDataAsCharArray,
XMLDocumentHandler docHandler,
XMLDocumentHandler.DTDHandler dtdHandler)
- Set char data processing preference and handlers.
getFeaturesRecognized
public java.lang.String[] getFeaturesRecognized()
- Returns a list of features that this parser recognizes.
This method will never return null; if no features are
recognized, this method will return a zero length array.
isFeatureRecognized
public boolean isFeatureRecognized(java.lang.String featureId)
- Returns true if the specified feature is recognized.
getPropertiesRecognized
public java.lang.String[] getPropertiesRecognized()
- Returns a list of properties that this parser recognizes.
This method will never return null; if no properties are
recognized, this method will return a zero length array.
isPropertyRecognized
public boolean isPropertyRecognized(java.lang.String propertyId)
- Returns true if the specified property is recognized.
parseSomeSetup
public boolean parseSomeSetup(org.xml.sax.InputSource source) throws java.lang.Exception
- Setup for application-driven parsing.
parseSome
public boolean parseSome()
throws java.lang.Exception
- Application-driven parsing.
reset
public void reset()
throws java.lang.Exception
- Reset parser instance so that it can be reused.
getLocator
public final org.xml.sax.Locator getLocator()
- return the locator being used by the parser
- Specified by:
getLocatorin interfaceXMLErrorReporter
setReaderFactory
public void setReaderFactory(org.apache.xerces.readers.XMLEntityReaderFactory readerFactory)
- Set the reader factory.
addRecognizer
public void addRecognizer(org.apache.xerces.readers.XMLDeclRecognizer recognizer)
- Adds a recognizer.
setValidation
protected void setValidation(boolean validate)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Sets whether the parser validates.
This method is the equivalent to the feature:
http://xml.org/sax/features/validation
getValidation
protected boolean getValidation()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if validation is turned on.
setExternalGeneralEntities
protected void setExternalGeneralEntities(boolean expand)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Note: Currently, this parser always expands external general
entities. Setting this feature to false will throw a
SAXNotSupportedException.
Sets whether external general entities are expanded.
This method is the equivalent to the feature:
http://xml.org/sax/features/external-general-entities
getExternalGeneralEntities
protected boolean getExternalGeneralEntities()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Note: This feature is always true.
Returns true if external general entities are expanded.
setExternalParameterEntities
protected void setExternalParameterEntities(boolean expand)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Note: Currently, this parser always expands external parameter
entities. Setting this feature to false will throw a
SAXNotSupportedException.
Sets whether external parameter entities are expanded.
This method is the equivalent to the feature:
http://xml.org/sax/features/external-parameter-entities
getExternalParameterEntities
protected boolean getExternalParameterEntities()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Note: This feature is always true.
Returns true if external parameter entities are expanded.
setNamespaces
protected void setNamespaces(boolean process)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Sets whether the parser preprocesses namespaces.
This method is the equivalent to the feature:
http://xml.org/sax/features/namespaces
getNamespaces
protected boolean getNamespaces()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if the parser preprocesses namespaces.
setValidationSchema
protected void setValidationSchema(boolean schema)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Allows the user to turn Schema support on/off.
This method is equivalent to the feature:
http://apache.org/xml/features/validation/schema
getValidationSchema
protected boolean getValidationSchema()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if Schema support is turned on.
setValidationDynamic
protected void setValidationDynamic(boolean dynamic)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Allows the parser to validate a document only when it contains a
grammar. Validation is turned on/off based on each document
instance, automatically.
This method is the equivalent to the feature:
http://apache.org/xml/features/validation/dynamic
getValidationDynamic
protected boolean getValidationDynamic()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if validation is based on whether a document
contains a grammar.
setLoadDTDGrammar
protected void setLoadDTDGrammar(boolean loadDTDGrammar)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Allows the parser to have the choice to load DTD grammar when
validation is off.
This method is the equivalent to the feature:
http://apache.org/xml/features/nonvalidating/load-dtd-grammar
getLoadDTDGrammar
protected boolean getLoadDTDGrammar()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if load DTD grammar is turned on in the XMLValiator.
setValidationWarnOnDuplicateAttdef
protected void setValidationWarnOnDuplicateAttdef(boolean warn)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Sets whether an error is emitted when an attribute is redefined
in the grammar.
This method is the equivalent to the feature:
http://apache.org/xml/features/validation/warn-on-duplicate-attdef
getValidationWarnOnDuplicateAttdef
protected boolean getValidationWarnOnDuplicateAttdef()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if an error is emitted when an attribute is redefined
in the grammar.
setValidationWarnOnUndeclaredElemdef
protected void setValidationWarnOnUndeclaredElemdef(boolean warn)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- 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.
This method is the equivalent to the feature:
http://apache.org/xml/features/validation/warn-on-undeclared-elemdef
getValidationWarnOnUndeclaredElemdef
protected boolean getValidationWarnOnUndeclaredElemdef()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if the parser emits an error when an undeclared
element is referenced in the grammar.
setAllowJavaEncodings
protected void setAllowJavaEncodings(boolean allow)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Allows the use of Java encoding names in the XMLDecl and TextDecl
lines in an XML document.
This method is the equivalent to the feature:
http://apache.org/xml/features/allow-java-encodings
getAllowJavaEncodings
protected boolean getAllowJavaEncodings()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if Java encoding names are allowed in the XML document.
setContinueAfterFatalError
protected void setContinueAfterFatalError(boolean continueAfterFatalError)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Allows the parser to continue after a fatal error. Normally, a
fatal error would stop the parse.
This method is the equivalent to the feature:
http://apache.org/xml/features/continue-after-fatal-error
getContinueAfterFatalError
protected boolean getContinueAfterFatalError()
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
- Returns true if the parser continues after a fatal error.
getXMLString
protected java.lang.String getXMLString() throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- This method is the equivalent to the property:
http://xml.org/sax/properties/xml-string
resetOrCopy
protected void resetOrCopy()
throws java.lang.Exception
- Reset or copy parser
Allows parser instance reuse
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
- Sets the resolver used to resolve external entities. The EntityResolver
interface supports resolution of public and system identifiers.
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
- Return the current entity resolver.
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
- Sets the error handler.
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
- Return the current error handler.
parse
public void parse(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, java.io.IOException
- Parses the specified input source.
parse
public void parse(java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
- Parses the input source specified by the given system identifier.
This method is equivalent to the following:
parse(new InputSource(systemId));
setLocale
public void setLocale(java.util.Locale locale) throws org.xml.sax.SAXException
- Set the locale to use for messages.
reportError
public void reportError(org.xml.sax.Locator locator, java.lang.String errorDomain, int majorCode, int minorCode, java.lang.Object[] args, int errorType) throws java.lang.Exception
- Report an error.
- Specified by:
reportErrorin interfaceXMLErrorReporter
setFeature
public void setFeature(java.lang.String featureId, boolean state) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Set the state of a feature.
Set the state of any feature in a SAX2 parser. The parser
might not recognize the feature, and if it does recognize
it, it might not be able to fulfill the request.
getFeature
public boolean getFeature(java.lang.String featureId) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Query the state of a feature.
Query the current state of any feature in a SAX2 parser. The
parser might not recognize the feature.
setProperty
public void setProperty(java.lang.String propertyId, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Set the value of a property.
Set the value of any property in a SAX2 parser. The parser
might not recognize the property, and if it does recognize
it, it might not support the requested value.
getProperty
public java.lang.Object getProperty(java.lang.String propertyId) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Query the value of a property.
Return the current value of a property in a SAX2 parser.
The parser might not recognize the property.
|
|||||||||
| Home >> All >> org >> apache >> xerces >> [ framework overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.xerces.framework.XMLParser