com.sun.xml.parser
Class ValidatingParser
java.lang.Object
|
+--com.sun.xml.parser.Parser
|
+--com.sun.xml.parser.ValidatingParser
- public class ValidatingParser
- extends Parser
This parser tests XML documents against the validity constraints
specified in the XML 1.0 specification as it parses them. It
reports violations of those constraints using the standard SAX API.
This parser should be configured to use an ErrorHandler
that reject documents with validity errors, otherwise they will be accepted
despite errors. The default error handling, as specified by SAX,
ignores all validity errors. The simplest way to have validity errors
have a useful effect is to pass a boolean true value to
the parser's constructor.
Note that most validity checks are performed during parsing by
the base class, for efficiency. They're disabled by default in
that class, and enabled by the constructor in this class.
Constructor Summary |
ValidatingParser()
Constructs a SAX parser object. |
ValidatingParser(boolean rejectValidityErrors)
Constructs a SAX parser object, optionally assigning the error
handler to report exceptions on recoverable errors (which include
all validity errors) as well as fatal errors. |
Methods inherited from class com.sun.xml.parser.Parser |
chooseLocale,
getDocumentHandler,
getDTDHandler,
getEntityResolver,
getErrorHandler,
getLocale,
isFastStandalone,
parse,
parse,
pushInputBuffer,
setDocumentHandler,
setDTDHandler,
setEntityResolver,
setErrorHandler,
setFastStandalone,
setLocale |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ValidatingParser
public ValidatingParser()
- Constructs a SAX parser object.
ValidatingParser
public ValidatingParser(boolean rejectValidityErrors)
- Constructs a SAX parser object, optionally assigning the error
handler to report exceptions on recoverable errors (which include
all validity errors) as well as fatal errors.
- Parameters:
rejectValidityErrors
- When true, the parser will use an
error handler which throws exceptions on recoverable errors.
Otherwise it uses the default SAX error handler, which ignores
such errors.
Submit Feedback to xml-feedback@java.sun.com