Package edu.isi.pegasus.planner.client
Class DAXValidator
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- edu.isi.pegasus.planner.client.DAXValidator
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class DAXValidator extends org.xml.sax.helpers.DefaultHandler
This class reads to validate a DAX document. It requires at least Xerces-J 2.10.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_errors
Counts the number of errors.protected int
m_fatals
Counts the number of fatal errors.private org.xml.sax.Locator
m_location
Keep the location within the document.private org.xml.sax.XMLReader
m_reader
Holds the instance of aXMLReader
class.private java.lang.String
m_schemafile
what is the name of the schema file in the filename hint?protected boolean
m_verbose
How verbose should we be?protected int
m_warnings
Counts the number of warnings.static java.lang.String
SCHEMA_NAMESPACE
URI namespace for DAX schema.protected static java.lang.String
vendorParserClass
Default parser is the Xerces parser.
-
Constructor Summary
Constructors Constructor Description DAXValidator(boolean verbose)
default c'tor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
endDocument()
void
endElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName)
void
error(org.xml.sax.SAXParseException ex)
void
fatalError(org.xml.sax.SAXParseException ex)
private java.lang.String
full_where()
void
ignorableWhitespace(char[] ch, int start, int length)
static void
main(java.lang.String[] args)
void
parse(java.lang.String filename)
private boolean
prop(java.lang.String uri, java.lang.Object value)
Sets a SAX property while capturing failed features right here.private boolean
set(java.lang.String uri, boolean flag)
Sets a feature while capturing failed features right here.void
setDocumentLocator(org.xml.sax.Locator locator)
void
startDocument()
void
startElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
boolean
statistics()
Show how many warnings, errors and fatals were shown.void
warning(org.xml.sax.SAXParseException ex)
private java.lang.String
where()
-
-
-
Field Detail
-
vendorParserClass
protected static final java.lang.String vendorParserClass
Default parser is the Xerces parser.- See Also:
- Constant Field Values
-
SCHEMA_NAMESPACE
public static final java.lang.String SCHEMA_NAMESPACE
URI namespace for DAX schema.- See Also:
- Constant Field Values
-
m_schemafile
private java.lang.String m_schemafile
what is the name of the schema file in the filename hint?
-
m_reader
private org.xml.sax.XMLReader m_reader
Holds the instance of aXMLReader
class.
-
m_location
private org.xml.sax.Locator m_location
Keep the location within the document.
-
m_verbose
protected boolean m_verbose
How verbose should we be?
-
m_warnings
protected int m_warnings
Counts the number of warnings.
-
m_errors
protected int m_errors
Counts the number of errors.
-
m_fatals
protected int m_fatals
Counts the number of fatal errors.
-
-
Method Detail
-
set
private boolean set(java.lang.String uri, boolean flag)
Sets a feature while capturing failed features right here.- Parameters:
uri
- is the feature's URI to modifyflag
- is the new value to set.- Returns:
- true, if the feature could be set, false for an exception
-
prop
private boolean prop(java.lang.String uri, java.lang.Object value)
Sets a SAX property while capturing failed features right here.- Parameters:
uri
- is the property's URI to modifyvalue
- is the new value to set.- Returns:
- true, if the feature could be set, false for an exception
-
warning
public void warning(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
- Specified by:
warning
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
warning
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
error
public void error(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
- Specified by:
error
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
error
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
fatalError
public void fatalError(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
- Specified by:
fatalError
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
fatalError
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
- Specified by:
setDocumentLocator
in interfaceorg.xml.sax.ContentHandler
- Overrides:
setDocumentLocator
in classorg.xml.sax.helpers.DefaultHandler
-
full_where
private java.lang.String full_where()
-
where
private java.lang.String where()
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument()
- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in classorg.xml.sax.helpers.DefaultHandler
-
startElement
public void startElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException
- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
- Specified by:
characters
in interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
- Specified by:
ignorableWhitespace
in interfaceorg.xml.sax.ContentHandler
- Overrides:
ignorableWhitespace
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
parse
public void parse(java.lang.String filename) throws java.lang.Exception
- Throws:
java.lang.Exception
-
statistics
public boolean statistics()
Show how many warnings, errors and fatals were shown.- Returns:
- true, if we should transmit an error exit code.
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-