286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Copyright 2001, 2002,2004 The Apache Software Foundation.
286N/A *
286N/A * Licensed under the Apache License, Version 2.0 (the "License");
286N/A * you may not use this file except in compliance with the License.
286N/A * You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A
286N/Apackage com.sun.org.apache.xerces.internal.dom;
286N/A
286N/Aimport org.w3c.dom.DOMError;
286N/Aimport org.w3c.dom.DOMLocator;
286N/Aimport com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
286N/A
286N/A
286N/A/**
286N/A * <code>DOMErrorImpl</code> is an implementation that describes an error.
286N/A * <strong>Note:</strong> The error object that describes the error
286N/A * might be reused by Xerces implementation, across multiple calls to the
286N/A * handleEvent method on DOMErrorHandler interface.
286N/A *
286N/A *
286N/A * <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010913'>Document Object Model (DOM) Level 3 Core Specification</a>.
286N/A *
286N/A * @xerces.internal
286N/A *
286N/A * @author Gopal Sharma, SUN Microsystems Inc.
286N/A * @author Elena Litani, IBM
286N/A *
286N/A */
286N/A
286N/A// REVISIT: the implementation of ErrorReporter.
286N/A// we probably should not pass XMLParseException
286N/A//
286N/A
286N/Apublic class DOMErrorImpl implements DOMError {
286N/A
286N/A //
286N/A // Data
286N/A //
286N/A
286N/A public short fSeverity = DOMError.SEVERITY_WARNING;
286N/A public String fMessage = null;
286N/A public DOMLocatorImpl fLocator = new DOMLocatorImpl();
286N/A public Exception fException = null;
286N/A public String fType;
286N/A public Object fRelatedData;
286N/A
286N/A
286N/A
286N/A //
286N/A // Constructors
286N/A //
286N/A
286N/A /** Default constructor. */
286N/A public DOMErrorImpl () {
286N/A }
286N/A
286N/A /** Exctracts information from XMLParserException) */
286N/A public DOMErrorImpl (short severity, XMLParseException exception) {
286N/A fSeverity = severity;
286N/A fException = exception;
286N/A fLocator = createDOMLocator (exception);
286N/A }
286N/A
286N/A /**
286N/A * The severity of the error, either <code>SEVERITY_WARNING</code>,
286N/A * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.
286N/A */
286N/A
286N/A public short getSeverity() {
286N/A return fSeverity;
286N/A }
286N/A
286N/A /**
286N/A * An implementation specific string describing the error that occured.
286N/A */
286N/A
286N/A public String getMessage() {
286N/A return fMessage;
286N/A }
286N/A
286N/A /**
286N/A * The location of the error.
286N/A */
286N/A
286N/A public DOMLocator getLocation() {
286N/A return fLocator;
286N/A }
286N/A
286N/A // method to get the DOMLocator Object
286N/A private DOMLocatorImpl createDOMLocator(XMLParseException exception) {
286N/A // assuming DOMLocator wants the *expanded*, not the literal, URI of the doc... - neilg
286N/A return new DOMLocatorImpl(exception.getLineNumber(),
286N/A exception.getColumnNumber(),
286N/A exception.getCharacterOffset(),
286N/A exception.getExpandedSystemId());
286N/A } // createDOMLocator()
286N/A
286N/A
286N/A /**
286N/A * The related platform dependent exception if any.exception is a reserved
286N/A * word, we need to rename it.Change to "relatedException". (F2F 26 Sep
286N/A * 2001)
286N/A */
286N/A public Object getRelatedException(){
286N/A return fException;
286N/A }
286N/A
286N/A public void reset(){
286N/A fSeverity = DOMError.SEVERITY_WARNING;
286N/A fException = null;
286N/A }
286N/A
286N/A public String getType(){
286N/A return fType;
286N/A }
286N/A
286N/A public Object getRelatedData(){
286N/A return fRelatedData;
286N/A }
286N/A
286N/A
286N/A}// class DOMErrorImpl