org.ceryle.ui
Class DocumentValidator

java.lang.Object
  extended by java.lang.Thread
      extended by org.ceryle.ui.DocumentValidator
All Implemented Interfaces:
Runnable

public class DocumentValidator
extends Thread

Extends Thread to validate an XML Document, provided with a Swing document. If verbose is true, indicates with progress bar and error messages. If not, is silent (not even error messages). This makes a first pass in validating mode if the Document has a DOCTYPE declaration, then a second pass if that fails. If there is no DOCTYPE, just a WF parse.

Author:
Murray Altheim

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DocumentValidator(DocumentView docview, Document doc, boolean verbose)
          Constructor provided with the Document to check.
 
Method Summary
 Document getDocument()
           
 Iterator getErrors()
          Return null if no errors, otherwise an Iterator over the parse Exceptions.
 boolean isDone()
          Returns true if the process is complete.
 boolean isOkay()
          Returns true if the document was either well-formed or valid.
 boolean isValidating()
          Returns true if the document was processed with a validating XML processor (as opposed to a well-formed XML processor).
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocumentValidator

public DocumentValidator(DocumentView docview,
                         Document doc,
                         boolean verbose)
                  throws ProcessException
Constructor provided with the Document to check.

Parameters:
docview - an optional parent DocumentView
doc - the Swing Document containing the content to be checked as XML
verbose - the verbosity flag.
Throws:
ProcessException
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

getDocument

public Document getDocument()

isDone

public boolean isDone()
Returns true if the process is complete.


isValidating

public boolean isValidating()
Returns true if the document was processed with a validating XML processor (as opposed to a well-formed XML processor).


isOkay

public boolean isOkay()
Returns true if the document was either well-formed or valid. I.e., it had no errors.


getErrors

public Iterator getErrors()
Return null if no errors, otherwise an Iterator over the parse Exceptions.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.