org.openxml.parser
Class DTDParser
java.lang.Object
|
+--org.openxml.parser.BaseParser
|
+--org.openxml.parser.DTDParser
- public class DTDParser
- extends BaseParser
- Version:
- $Revision: 1.9 $ $Date: 1999/04/18 01:52:12 $
- Author:
- Assaf Arkin
- See Also:
Parser
Fields inherited from class org.openxml.parser.BaseParser |
_curChar,
_document,
_tokenText,
CR,
EOF,
LF,
SPACE,
TOKEN_CDATA,
TOKEN_CLOSE_TAG,
TOKEN_COMMENT,
TOKEN_DTD,
TOKEN_ENTITY_REF,
TOKEN_EOF,
TOKEN_OPEN_TAG,
TOKEN_PE_REF,
TOKEN_PI,
TOKEN_SECTION,
TOKEN_SECTION_END,
TOKEN_TEXT |
Constructor Summary |
DTDParser(BaseParser owner,
java.io.Reader reader,
java.lang.String sourceURI)
Constructor for entity parser. |
DTDParser(java.io.Reader reader,
java.lang.String sourceURI)
|
DTDParser(java.io.Reader reader,
java.lang.String sourceURI,
short mode,
short stopAtSeverity)
|
Methods inherited from class org.openxml.parser.BaseParser |
advanceLineNumber,
canReadName,
close,
error,
fatalError,
getColumnNumber,
getErrorHandler,
getErrorReport,
getLastException,
getLineNumber,
getLocator,
getMode,
getPublicId,
getReader,
getSourcePosition,
getSourceURI,
getSystemId,
isClosed,
isMode,
isNamePart,
isSpace,
isTokenAllSpace,
parseDocumentDecl,
parseGeneralEntity,
pushBack,
pushBack,
readChar,
readTokenEntity,
readTokenMarkup,
readTokenName,
readTokenPERef,
readTokenQuoted,
setEncoding,
setErrorHandler,
setErrorSink,
slicePITokenText,
warning |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
DTDParser
public DTDParser(java.io.Reader reader,
java.lang.String sourceURI,
short mode,
short stopAtSeverity)
DTDParser
public DTDParser(BaseParser owner,
java.io.Reader reader,
java.lang.String sourceURI)
- Constructor for entity parser. Requires a parent parser to be specified and
will use that parser's document, dtd, error sink and mode (assuming that
Parser.MODE_PARSE_ENTITY
is in effect). The severity level is set to
Parser.STOP_SEVERITY_FATAL
.
- Parameters:
owner
- The parser which invoked this parserreader
- Any Reader
from which entity text can be readsourceURI
- URI of entity source
DTDParser
public DTDParser(java.io.Reader reader,
java.lang.String sourceURI)
parseInternalSubset
public DTDDocument parseInternalSubset(DTDDocument dtd)
throws SAXException
parseExternalSubset
public DTDDocument parseExternalSubset(DTDDocument dtd)
throws SAXException
parseParamEntity
public DTDDocument parseParamEntity(DTDDocument dtd,
boolean internal)
throws SAXException
parseDocument
public Document parseDocument()
throws SAXException
parseNode
public final Node parseNode(Node node)
throws SAXException
parseParamEntity
protected final org.openxml.dom.ParamEntity parseParamEntity(org.openxml.dom.ParamEntity entity)
throws SAXException
- Parses the parameter entity, returning the entity as parsed. An existing
ParamEntity
is passed to the method. On exit,
the same entity (parsed) is returned, or null to indicate that the entity
could not be parsed.
The following rules govern how the entity is parsed:
- If the entity's state is
ParamEntity.STATE_PARSED
, then the
entity has been parsed before, and is returned.
- If the entity's state is
ParamEntity.STATE_NOT_FOUND
, then
the entity could not be found, and null is returned. There is no need
to issue an error again.
- If the entity's state is
ParamEntity.STATE_PARSING
, then the
entity is being parsed: this is a circular reference, an error is issued
and null is returned.
- If the entity's state is
ParamEntity.STATE_DECLARED
, then the
entity is being parsed. For an external entity, the entity source is being
located using HolderFinder
. If the entity source could
not be found or could not be opened, the entity state is set to ParamEntity.STATE_NOT_FOUND
, an error is issued and null returned.
For an internal entity, the entity source is created from it's value.
- If the entity's state is
ParamEntity.STATE_DECLARED
and the
entity source could be located, an DTDParser
is created and used
to parse the entity. If no fatal errors are encountered when parsing,
the entity is returned. Well formed errors are treated as if generated
by the current parser.
- If the entity's state is
ParamEntity.STATE_DECLARED
and a fatal
error was issued while parsing the entity with an DTDParser
, then
a fatal error is issued and an exception raised.
Well formed and validity errors issued by the external entity parser are
reported directly to this parser and treated by the error mode of this
entity. Fatal and I/O exceptions will terminate parsing with a fatal error.
- Parameters:
entity
- The entity to parse- Returns:
- The entity if parsed, null if could not be parsed
- Throws:
- SAXException - A parsing error has been encountered, and based on
it severity, an exception is thrown to terminate parsing
createAttribute
protected Attr createAttribute(java.lang.String attrName)