KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > builder > util > XmlParseException


1 /*
2  * $RCSfile: XmlParseException.java,v $
3  * @modification $Date: 2001/09/28 19:41:42 $
4  * @version $Id: XmlParseException.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
5  *
6  */

7
8 package com.memoire.vainstall.builder.util;
9
10 import org.xml.sax.*;
11
12 /**
13  * This exception class wraps a SAXParseException and is
14  * able to return its message as formatted HTML.
15  *
16  * @see org.xml.sax.SAXParseException
17  *
18  * @author Henrik Falk
19  * @version $Id: XmlParseException.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
20  */

21 public class XmlParseException extends SAXParseException {
22
23     private SAXParseException saxParseException;
24
25     public XmlParseException(SAXParseException exc) {
26         super(exc.getMessage(),(Locator)null);
27         saxParseException = exc;
28     }
29
30     public XmlParseException(String JavaDoc message, Locator locator) {
31         super(message,locator);
32         saxParseException = this;
33     }
34
35     public String JavaDoc getMessageAsHtml() {
36
37         String JavaDoc out = "<html><b><font color=black size=2><left>";
38         out += "Parser Error :<br>";
39         out += "<font color=red size=2>"+saxParseException.getMessage()+"</font><br>";
40         out += "Line = <font color=red size=2>"+saxParseException.getLineNumber()+"</font><br>";
41         out += "Column = <font color=red size=2>"+saxParseException.getColumnNumber()+"</font>";
42         out += "</left></font></b></html>";
43
44         return out;
45     }
46
47 }
48
Popular Tags