FileDocCategorySizeDatePackage
XmlErrorHandler.javaAPI DocAndroid 1.5 API3832Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.common.project

XmlErrorHandler

public class XmlErrorHandler extends DefaultHandler
XML error handler used by the parser to report errors/warnings.

Fields Summary
private org.eclipse.core.resources.IFile
mFile
file being parsed
private XmlErrorListener
mErrorListener
link to the delta visitor, to set the xml error flag
Constructors Summary
public XmlErrorHandler(org.eclipse.core.resources.IFile file, XmlErrorListener errorListener)

        mFile = file;
        mErrorListener = errorListener;
    
Methods Summary
public voiderror(org.xml.sax.SAXParseException exception)
Xml Error call back

param
exception the parsing exception
throws
SAXException

        handleError(exception, exception.getLineNumber());
    
public voidfatalError(org.xml.sax.SAXParseException exception)
Xml Fatal Error call back

param
exception the parsing exception
throws
SAXException

        handleError(exception, exception.getLineNumber());
    
protected final org.eclipse.core.resources.IFilegetFile()

        return mFile;
    
protected voidhandleError(java.lang.Exception exception, int lineNumber)
Handles a parsing error and an optional line number.

param
exception
param
lineNumber

        if (mErrorListener != null) {
            mErrorListener.errorFound();
        }
        
        if (mFile != null) {
            if (lineNumber != -1) {
                BaseProjectHelper.addMarker(mFile,
                        AndroidConstants.MARKER_XML,
                        exception.getMessage(),
                        lineNumber,
                        IMarker.SEVERITY_ERROR);
            } else {
                BaseProjectHelper.addMarker(mFile,
                        AndroidConstants.MARKER_XML,
                        exception.getMessage(),
                        IMarker.SEVERITY_ERROR);
            }
        }
    
public voidwarning(org.xml.sax.SAXParseException exception)
Xml Warning call back

param
exception the parsing exception
throws
SAXException

        if (mFile != null) {
            BaseProjectHelper.addMarker(mFile,
                    AndroidConstants.MARKER_XML,
                    exception.getMessage(),
                    exception.getLineNumber(),
                    IMarker.SEVERITY_WARNING);
        }