org.daisy.zedval.engine
Class XslTestProcessor

java.lang.Object
  extended byorg.daisy.zedval.engine.ZedTestProcessor
      extended byorg.daisy.zedval.engine.XslTestProcessor
All Implemented Interfaces:
javax.xml.transform.ErrorListener, javax.xml.transform.URIResolver

public class XslTestProcessor
extends ZedTestProcessor
implements javax.xml.transform.ErrorListener, javax.xml.transform.URIResolver

An XslTestProcessor object executes tests via an XSLT stylesheet

Author:
James Pritchett, Piotr Kiernicki, Markus Gylling

Constructor Summary
XslTestProcessor(java.lang.String id, java.lang.String l, java.util.LinkedHashMap tests, java.util.LinkedHashMap files, ZedContext c, java.lang.String sheetName)
           
 
Method Summary
 void error(javax.xml.transform.TransformerException e)
          Receives notification of a recoverable (probably validation) error
 void fatalError(javax.xml.transform.TransformerException e)
          Receives notification of a non-recoverable (probably well-formedness) error
 java.net.URL getSheetUrl()
          Returns the XSL stylesheet used by this processor
 boolean performTests()
          Runs all files through the stylesheet
 javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base)
          Creates a SAXSource for any document pulled in through a document() call.
 java.lang.String toString()
           
 void warning(javax.xml.transform.TransformerException e)
          Receives notification of a warning
 
Methods inherited from class org.daisy.zedval.engine.ZedTestProcessor
getContext, getFilesTested, getId, getLabel, getTestsImplemented
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XslTestProcessor

public XslTestProcessor(java.lang.String id,
                        java.lang.String l,
                        java.util.LinkedHashMap tests,
                        java.util.LinkedHashMap files,
                        ZedContext c,
                        java.lang.String sheetName)
Parameters:
id - Id for this ZedTestProcessor (from processor map)
l - Name for this ZedTestProcessor
tests - LinkedHashMap of ZedTests that this ZedTestProcessor implements (key = id)
files - LinkedHashMap of ZedFiles upon which this ZedTestProcessor is to be invoked (key = absolute full path)
c - ZedContext for this run
sheetName - Full name/path of XSLT stylesheet to execute
Method Detail

performTests

public boolean performTests()
Runs all files through the stylesheet

Overrides:
performTests in class ZedTestProcessor
Returns:
TRUE if tests were performed on one or more files

getSheetUrl

public java.net.URL getSheetUrl()
Returns the XSL stylesheet used by this processor

Returns:
File objecgt for XSL stylesheet

error

public void error(javax.xml.transform.TransformerException e)
Receives notification of a recoverable (probably validation) error

Specified by:
error in interface javax.xml.transform.ErrorListener
Parameters:
e - The exception that represents the error

fatalError

public void fatalError(javax.xml.transform.TransformerException e)
Receives notification of a non-recoverable (probably well-formedness) error

Specified by:
fatalError in interface javax.xml.transform.ErrorListener
Parameters:
e - The exception that represents the error

warning

public void warning(javax.xml.transform.TransformerException e)
Receives notification of a warning

Specified by:
warning in interface javax.xml.transform.ErrorListener
Parameters:
e - The exception that represents the warning

resolve

public javax.xml.transform.Source resolve(java.lang.String href,
                                          java.lang.String base)
                                   throws javax.xml.transform.TransformerException
Creates a SAXSource for any document pulled in through a document() call. This version will use our standard entity resolver mechanism to use local copies of all known DTDs.

Specified by:
resolve in interface javax.xml.transform.URIResolver
Parameters:
href - The URI to resolve (relative or absolute)
base - The base URI in effect at the time href was encountered
Returns:
A SAXSource built from our local XMLReader that uses an XmlFile as an EntityResolver
Throws:
javax.xml.transform.TransformerException

toString

public java.lang.String toString()
Overrides:
toString in class ZedTestProcessor