2 * Licensed to the Apache Software Foundation (ASF) under one
\r
3 * or more contributor license agreements. See the NOTICE file
\r
4 * distributed with this work for additional information
\r
5 * regarding copyright ownership. The ASF licenses this file
\r
6 * to you under the Apache License, Version 2.0 (the "License");
\r
7 * you may not use this file except in compliance with the License.
\r
8 * You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software
\r
13 * distributed under the License is distributed on an "AS IS" BASIS,
\r
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
15 * See the License for the specific language governing permissions and
\r
16 * limitations under the License.
\r
22 package org.apache.xml.serializer.dom3;
\r
24 import org.w3c.dom.DOMError;
\r
25 import org.w3c.dom.DOMLocator;
\r
28 * Implementation of the DOM Level 3 DOMError interface.
\r
30 * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ERROR-Interfaces-DOMError'>DOMError Interface definition from Document Object Model (DOM) Level 3 Core Specification</a>.
\r
32 * @xsl.usage internal
\r
35 public final class DOMErrorImpl implements DOMError {
\r
37 /** private data members */
\r
39 // The DOMError Severity
\r
40 private short fSeverity = DOMError.SEVERITY_WARNING;
\r
42 // The Error message
\r
43 private String fMessage = null;
\r
45 // A String indicating which related data is expected in relatedData.
\r
46 private String fType;
\r
48 // The platform related exception
\r
49 private Exception fException = null;
\r
52 private Object fRelatedData;
\r
54 // The location of the exception
\r
55 private DOMLocatorImpl fLocation = new DOMLocatorImpl();
\r
63 * Default constructor.
\r
73 public DOMErrorImpl(short severity, String message, String type) {
\r
74 fSeverity = severity;
\r
85 public DOMErrorImpl(short severity, String message, String type,
\r
86 Exception exception) {
\r
87 fSeverity = severity;
\r
90 fException = exception;
\r
98 * @param relatedData
\r
101 public DOMErrorImpl(short severity, String message, String type,
\r
102 Exception exception, Object relatedData, DOMLocatorImpl location) {
\r
103 fSeverity = severity;
\r
104 fMessage = message;
\r
106 fException = exception;
\r
107 fRelatedData = relatedData;
\r
108 fLocation = location;
\r
113 * The severity of the error, either <code>SEVERITY_WARNING</code>,
\r
114 * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.
\r
116 * @return A short containing the DOMError severity
\r
118 public short getSeverity() {
\r
123 * The DOMError message string.
\r
127 public String getMessage() {
\r
132 * The location of the DOMError.
\r
134 * @return A DOMLocator object containing the DOMError location.
\r
136 public DOMLocator getLocation() {
\r
141 * The related platform dependent exception if any.
\r
143 * @return A java.lang.Exception
\r
145 public Object getRelatedException(){
\r
150 * Returns a String indicating which related data is expected in relatedData.
\r
154 public String getType(){
\r
159 * The related DOMError.type dependent data if any.
\r
161 * @return java.lang.Object
\r
163 public Object getRelatedData(){
\r
164 return fRelatedData;
\r
167 public void reset(){
\r
168 fSeverity = DOMError.SEVERITY_WARNING;
\r
172 fRelatedData = null;
\r
176 }// class DOMErrorImpl
\r