public class DasMLValidator
extends org.xml.sax.helpers.DefaultHandler
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
FLOAT_PATTERN |
static java.util.regex.Pattern |
INTEGER_PATTERN |
static java.util.regex.Pattern |
WINDOW_POSITION_PATTERN |
Constructor and Description |
---|
DasMLValidator()
Creates a new instance of DasMLValidator
|
Modifier and Type | Method and Description |
---|---|
void |
endDocument()
Receive notification of the end of the document.
|
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName) |
void |
error(org.xml.sax.SAXParseException e)
Receive notification of a recoverable parser error.
|
void |
fatalError(org.xml.sax.SAXParseException e)
Report a fatal XML parsing error.
|
org.xml.sax.SAXException |
getLastError()
Returns the last error encountered by this validator
or null if no error has been found.
|
static void |
main(java.lang.String[] args) |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Receive a Locator object for document events.
|
void |
startDocument()
Receive notification of the beginning of the document.
|
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes)
Receive notification of the start of an element.
|
boolean |
validate(org.xml.sax.InputSource source,
org.xml.sax.ErrorHandler errorHandler)
Parses and validates a dasML document.
|
void |
warning(org.xml.sax.SAXParseException e)
Receive notification of a parser warning.
|
public static final java.util.regex.Pattern INTEGER_PATTERN
public static final java.util.regex.Pattern WINDOW_POSITION_PATTERN
public static final java.util.regex.Pattern FLOAT_PATTERN
public DasMLValidator() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
public boolean validate(org.xml.sax.InputSource source, org.xml.sax.ErrorHandler errorHandler) throws java.io.IOException
source
- The source of the XML documenterrorHandler
- The ErrorHandler instance that will receive
error messages from the parser. This can be nulljava.io.IOException
- if the there is an error while reading the document.public org.xml.sax.SAXException getLastError()
public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
fatalError
in class org.xml.sax.helpers.DefaultHandler
e
- The error information encoded as an exception.org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.fatalError(org.xml.sax.SAXParseException)
,
SAXParseException
public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
locator
- A locator for all SAX document events.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
,
Locator
public void error(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
error
in class org.xml.sax.helpers.DefaultHandler
e
- The warning information encoded as an exception.org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.warning(org.xml.sax.SAXParseException)
,
SAXParseException
public void warning(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
warning
in class org.xml.sax.helpers.DefaultHandler
e
- The warning information encoded as an exception.org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.warning(org.xml.sax.SAXParseException)
,
SAXParseException
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startDocument()
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
qName
- The element type name.attributes
- The specified or defaulted attributes.org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()
public static void main(java.lang.String[] args)
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException