edu.isi.pegasus.planner.client
Class DAXValidator

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by edu.isi.pegasus.planner.client.DAXValidator
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class DAXValidator
extends DefaultHandler

This class reads to validate a DAX document. It requires at least Xerces-J 2.10.


Field Summary
protected  int m_errors
          Counts the number of errors.
protected  int m_fatals
          Counts the number of fatal errors.
private  Locator m_location
          Keep the location within the document.
private  XMLReader m_reader
          Holds the instance of a XMLReader class.
private  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 String SCHEMA_NAMESPACE
          URI namespace for DAX schema.
protected static String vendorParserClass
          Default parser is the Xerces parser.
 
Constructor Summary
DAXValidator(boolean verbose)
          default c'tor
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(String nsURI, String localName, String qName)
           
 void error(SAXParseException ex)
           
 void fatalError(SAXParseException ex)
           
private  String full_where()
           
 void ignorableWhitespace(char[] ch, int start, int length)
           
static void main(String[] args)
           
 void parse(String filename)
           
private  boolean prop(String uri, Object value)
          Sets a SAX property while capturing failed features right here.
private  boolean set(String uri, boolean flag)
          Sets a feature while capturing failed features right here.
 void setDocumentLocator(Locator locator)
           
 void startDocument()
           
 void startElement(String nsURI, String localName, String qName, Attributes attrs)
           
 boolean statistics()
          Show how many warnings, errors and fatals were shown.
 void warning(SAXParseException ex)
           
private  String where()
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vendorParserClass

protected static final String vendorParserClass
Default parser is the Xerces parser.

See Also:
Constant Field Values

SCHEMA_NAMESPACE

public static final String SCHEMA_NAMESPACE
URI namespace for DAX schema.

See Also:
Constant Field Values

m_schemafile

private String m_schemafile
what is the name of the schema file in the filename hint?


m_reader

private XMLReader m_reader
Holds the instance of a XMLReader class.


m_location

private 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.

Constructor Detail

DAXValidator

public DAXValidator(boolean verbose)
             throws Exception
default c'tor

Throws:
Exception
Method Detail

set

private boolean set(String uri,
                    boolean flag)
Sets a feature while capturing failed features right here.

Parameters:
uri - is the feature's URI to modify
flag - is the new value to set.
Returns:
true, if the feature could be set, false for an exception

prop

private boolean prop(String uri,
                     Object value)
Sets a SAX property while capturing failed features right here.

Parameters:
uri - is the property's URI to modify
value - is the new value to set.
Returns:
true, if the feature could be set, false for an exception

warning

public void warning(SAXParseException ex)
             throws SAXException
Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Throws:
SAXException

error

public void error(SAXParseException ex)
           throws SAXException
Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Throws:
SAXException

fatalError

public void fatalError(SAXParseException ex)
                throws SAXException
Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Throws:
SAXException

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class DefaultHandler

full_where

private String full_where()

where

private String where()

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
Throws:
SAXException

endDocument

public void endDocument()
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler

startElement

public void startElement(String nsURI,
                         String localName,
                         String qName,
                         Attributes attrs)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException

endElement

public void endElement(String nsURI,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class DefaultHandler
Throws:
SAXException

parse

public void parse(String filename)
           throws Exception
Throws:
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(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2011 The University of Southern California. All Rights Reserved.