Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 827 → Rev 828

/sun/xmleditor/trunk/src/parser/Parser.java
4,10 → 4,10
* Coded by: Group 5, software practice summer 2003
* University of Bielefeld, Germany
*
* @version $Revision: 1.59 $
* @version $Revision: 1.60 $
*
* Last modification: $Date: 2003/07/25 12:12:11 $
* $Id: Parser.java,v 1.59 2003/07/25 12:12:11 smcsporr Exp $
* Last modification: $Date: 2003/07/25 14:56:04 $
* $Id: Parser.java,v 1.60 2003/07/25 14:56:04 smcsporr Exp $
*/
 
package src.parser;
41,9 → 41,8
import org.apache.xerces.xni.grammars.XSGrammar;
import org.apache.xerces.xni.grammars.XMLDTDDescription;
import org.apache.xerces.xni.grammars.XMLGrammarDescription;
import org.apache.xerces.xni.parser.XMLErrorHandler;
 
import org.apache.xerces.xni.parser.XMLInputSource;
import org.apache.xerces.xni.parser.XMLParseException;
 
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
65,7 → 64,7
*
* @author Group 5
*
* @version $Revision: 1.59 $ Last modification: $Date: 2003/07/25 12:12:11 $
* @version $Revision: 1.60 $ Last modification: $Date: 2003/07/25 14:56:04 $
*/
public class Parser {
 
420,8 → 419,12
}
 
/**
* This method sets an internal reference to the log panel that is used to
* output logging messages to inform the user about program events.
* This method sets an internal reference to the log panel.
*
* A log panel is used to output logging messages to inform the
* user about program events. This specific method also sends
* a reference to the associated <code>GrammarErrorHandler</code> to
* enable log output for error messages during grammar parsing.
*
* @param log A log panel implementation compliant to src.gui.LogInterface.
*
431,6 → 434,8
*/
public void setLogInterface(LogInterface log) {
logInterfaceReference = log;
grammarErrorHandler.setLogInterface(log);
}
 
/**
479,69 → 484,5
private void setPoint(Point point) {
statusInterfaceReference.setPoint(point);
}
/**
* The <b><code>GrammarErrorHandler</code></b> class supplies an error handler for the
* an XML grammar preparser.
* An error handler retrieves and handles error events sent by a parser. These
* errors include warnings, errors and fatal errors.
*
* @author S. McSporran
*
* @version $Revision: 1.26 $ Last modification: $Date: 2003/07/25 11:52:17 $
*/
private class GrammarErrorHandler implements XMLErrorHandler {
/**
* A method that catches parsing warnings and sends them to the log panel.
* Warnings indicate that something might be missing or incorrect in a grammar file,
* while no wellformedness rule has been broken.
*
* @param domain The domain of the warning, suggested to be a valid URI.
* @param key The warning key; can be any string and is implementation dependent.
* @param xpe A warning event sent by a parser.
*
* author S. McSporran
*
* Last revision: 25-Jul-2003 by S. McSporran
*/
public void warning(String domain, String key, XMLParseException xpe){
log(LogInterface.TYPE_WARNING, "Grammar parsing warning: " + xpe.getMessage());
}
/**
* A method that catches parsing errors and sends them to the log panel.
* Errors occur during parsing, if a grammar rule has been broken, but
* the parser will be able to continue.
*
* @param domain The domain of the error, suggested to be a valid URI.
* @param key The error key; can be any string and is implementation dependent.
* @param xpe An error event sent by a parser.
*
* author S. McSporran
*
* Last revision: 25-Jul-2003 by S. McSporran
*/
public void error(String domain, String key, XMLParseException xpe) {
log(LogInterface.TYPE_ERROR, "Error ! Grammar parsing failure: " + xpe.getMessage());
}
/**
* A method that catches parsing fatal errors and sends them to the log panel.
* Fatal errors indicate that a grammar rule has been broken that makes continued
* parsing impossible.
*
* @param domain The domain of the fatal error, suggested to be a valid URI.
* @param key The fatal error key; can be any string and is implementation dependent.
* @param xpe A fatal error event sent by a parser.
*
* author S. McSporran
*
* Last revision: 25-Jul-2003 by S. McSporran
*/
public void fatalError(String domain, String key, XMLParseException xpe) {
log(LogInterface.TYPE_ERROR, "Fatal error ! Grammar parsing failure: " +
xpe.getMessage());
}
}
 
}