jcreek.cke.importexport.xml
Class DefaultGeneralParser

java.lang.Object
  extended byjcreek.cke.importexport.xml.DefaultGeneralParser
Direct Known Subclasses:
JCXMLexportParser, XMLvalidater

public class DefaultGeneralParser
extends java.lang.Object

The intention of this class is to have a class that may be used in most situations where basic settings of a DOM parser are needed. This parser may as well be more specialized by creating a class extending this class.

Author:
Stein L. Tomassen, NTNU 2002

Field Summary
static int DEFFERED_DOM
          Xerces deffered dom support by parser feature
static int INCLUDE_IGNORABLE_WHITESPACE
          Xerces include ignorable whitespaces when parsing feature
static int NAMESPACES
          Xerces namespaces consideration by parser feature
static int SCHEMA_FULL_SUPPORT
          Xerces full schema support by parser feature
static int SCHEMA_SUPPORT
          Xerces schema support by parser feature
static int VALIDATION
          Xerces validation by parser feature
 
Constructor Summary
DefaultGeneralParser()
           
 
Method Summary
 boolean anyFaults()
          Checks if there where any faults reported.
 java.lang.String getAllFaultMsg()
          A method that returns all the error messages that have occured during the parsing gathered in one string.
 java.lang.String getErrorsMsg()
           
 java.lang.String getFatalErrorsMsg()
           
 int getNumberOfErrors()
           
 int getNumberOfFatalErrors()
           
 int getNumberOfWarnings()
           
 java.lang.String getWarningsMsg()
           
 void initParser()
          Initializes the parser and sets the features of the parser to the default values if not set otherwise by the setFeature method.
 org.w3c.dom.Document parse(org.w3c.dom.Document document)
           
 org.w3c.dom.Document parse(java.io.InputStream istream)
           
 org.w3c.dom.Document parse(java.io.Reader reader)
           
 org.w3c.dom.Document parse(java.lang.String url)
           
 void setFeature(int feature, boolean state)
          Set features of the parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION

public static final int VALIDATION
Xerces validation by parser feature

See Also:
Constant Field Values

NAMESPACES

public static final int NAMESPACES
Xerces namespaces consideration by parser feature

See Also:
Constant Field Values

SCHEMA_SUPPORT

public static final int SCHEMA_SUPPORT
Xerces schema support by parser feature

See Also:
Constant Field Values

SCHEMA_FULL_SUPPORT

public static final int SCHEMA_FULL_SUPPORT
Xerces full schema support by parser feature

See Also:
Constant Field Values

DEFFERED_DOM

public static final int DEFFERED_DOM
Xerces deffered dom support by parser feature

See Also:
Constant Field Values

INCLUDE_IGNORABLE_WHITESPACE

public static final int INCLUDE_IGNORABLE_WHITESPACE
Xerces include ignorable whitespaces when parsing feature

See Also:
Constant Field Values
Constructor Detail

DefaultGeneralParser

public DefaultGeneralParser()
Method Detail

initParser

public void initParser()
                throws java.lang.Exception
Initializes the parser and sets the features of the parser to the default values if not set otherwise by the setFeature method.

Throws:
java.lang.Exception - throws an exception if an fatal error occurs
See Also:
setFeature(int, boolean)

parse

public org.w3c.dom.Document parse(java.lang.String url)
                           throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
DOMparserWrapper.parse(String)

parse

public org.w3c.dom.Document parse(java.io.InputStream istream)
                           throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
DOMparserWrapper.parse(InputStream)

parse

public org.w3c.dom.Document parse(java.io.Reader reader)
                           throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
DOMparserWrapper.parse(Reader)

parse

public org.w3c.dom.Document parse(org.w3c.dom.Document document)
                           throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
DOMparserWrapper.parse(Document)

setFeature

public void setFeature(int feature,
                       boolean state)
Set features of the parser. Note that a feature will not be put in action before the method initParser() is called.

Parameters:
feature - the feature to set, declared as static constants for this class
state - set to true to enabled the specified feature and false to disable the feature.
See Also:
initParser()

anyFaults

public boolean anyFaults()
Checks if there where any faults reported. If there where any faults, then that indicate that the document is not valid

Returns:
true if any faults where reported, else returning false

getAllFaultMsg

public java.lang.String getAllFaultMsg()
A method that returns all the error messages that have occured during the parsing gathered in one string.

Returns:
the string containing all the error messages that have occured.

getNumberOfErrors

public int getNumberOfErrors()
See Also:
DOMparserWrapper.getNumberOfErrors()

getErrorsMsg

public java.lang.String getErrorsMsg()
See Also:
DOMparserWrapper.getErrorsMsg()

getNumberOfWarnings

public int getNumberOfWarnings()
See Also:
DOMparserWrapper.getNumberOfWarnings()

getWarningsMsg

public java.lang.String getWarningsMsg()
See Also:
DOMparserWrapper.getWarningsMsg()

getNumberOfFatalErrors

public int getNumberOfFatalErrors()
See Also:
DOMparserWrapper.getNumberOfFatalErrors()

getFatalErrorsMsg

public java.lang.String getFatalErrorsMsg()
See Also:
DOMparserWrapper.getFatalErrorsMsg()


Created at IDI, NTNU by the Artificial Intelligence and Learning group