KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > trans > DynamicError


1 package net.sf.saxon.trans;
2
3 import net.sf.saxon.expr.XPathContext;
4
5 import javax.xml.transform.SourceLocator JavaDoc;
6 import javax.xml.transform.TransformerException JavaDoc;
7
8 /**
9 * Subclass of XPathException used for dynamic errors
10 */

11
12 public class DynamicError extends XPathException {
13
14     XPathContext context;
15     //boolean isTypeError = false;
16

17     public DynamicError(String JavaDoc message) {
18         super(message);
19     }
20
21     public DynamicError(Throwable JavaDoc err) {
22         super(err);
23     }
24
25     public DynamicError(String JavaDoc message, Throwable JavaDoc err) {
26         super(message, err);
27     }
28
29     public DynamicError(String JavaDoc message, SourceLocator JavaDoc loc) {
30         super(message, loc);
31     }
32
33     public DynamicError(String JavaDoc message, SourceLocator JavaDoc loc, Throwable JavaDoc err) {
34         super(message, loc, err);
35     }
36
37     public void setXPathContext(XPathContext context) {
38         this.context = context;
39     }
40
41     public XPathContext getXPathContext() {
42         return context;
43     }
44
45     public static DynamicError makeDynamicError(TransformerException JavaDoc err) {
46         if (err instanceof DynamicError) {
47             return (DynamicError)err;
48         } else if (err instanceof XPathException) {
49             DynamicError de = new DynamicError(err);
50             de.setErrorCode(((XPathException)err).getErrorCodeLocalPart());
51             de.setLocator(err.getLocator());
52             return de;
53         } else {
54             return new DynamicError(err);
55         }
56     }
57 }
58
Popular Tags