KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > dom > DOMLocatorImpl


1 /*
2  * Copyright 2001, 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.dom;
18
19 import org.w3c.dom.DOMLocator JavaDoc;
20 import org.w3c.dom.Node JavaDoc;
21
22
23 /**
24  * <code>DOMLocatorImpl</code> is an implementaion that describes a location (e.g.
25  * where an error occured).
26  * <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>.
27  *
28  * @xerces.internal
29  *
30  * @author Gopal Sharma, SUN Microsystems Inc.
31  * @version $Id: DOMLocatorImpl.java,v 1.12 2005/05/02 22:02:22 mrglavas Exp $
32  */

33  
34 public class DOMLocatorImpl implements DOMLocator JavaDoc {
35
36     //
37
// Data
38
//
39

40    /**
41     * The column number where the error occured,
42     * or -1 if there is no column number available.
43     */

44    public int fColumnNumber = -1;
45
46    /**
47     * The line number where the error occured,
48     * or -1 if there is no line number available.
49     */

50    public int fLineNumber = -1;
51
52    /** related data node*/
53    public Node JavaDoc fRelatedNode = null;
54
55    /**
56     * The URI where the error occured,
57     * or null if there is no URI available.
58     */

59    public String JavaDoc fUri = null;
60
61    /**
62     * The byte offset into the input source this locator is pointing to or -1
63     * if there is no byte offset available
64     */

65    public int fByteOffset = -1;
66    
67    /**
68     * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646],
69     * offset into the input source this locator is pointing to or -1 if there
70     * is no UTF-16 offset available.
71     */

72    public int fUtf16Offset = -1;
73            
74    //
75
// Constructors
76
//
77

78    public DOMLocatorImpl(){
79    }
80
81    public DOMLocatorImpl (int lineNumber, int columnNumber, String JavaDoc uri ){
82     fLineNumber = lineNumber ;
83     fColumnNumber = columnNumber ;
84     fUri = uri;
85    } // DOMLocatorImpl (int lineNumber, int columnNumber, String uri )
86

87    public DOMLocatorImpl (int lineNumber, int columnNumber, int utf16Offset, String JavaDoc uri ){
88     fLineNumber = lineNumber ;
89     fColumnNumber = columnNumber ;
90     fUri = uri;
91     fUtf16Offset = utf16Offset;
92    } // DOMLocatorImpl (int lineNumber, int columnNumber, int utf16Offset, String uri )
93

94    public DOMLocatorImpl (int lineNumber, int columnNumber, int byteoffset, Node JavaDoc relatedData, String JavaDoc uri ){
95     fLineNumber = lineNumber ;
96     fColumnNumber = columnNumber ;
97     fByteOffset = byteoffset ;
98     fRelatedNode = relatedData ;
99     fUri = uri;
100    } // DOMLocatorImpl (int lineNumber, int columnNumber, int offset, Node errorNode, String uri )
101

102    public DOMLocatorImpl (int lineNumber, int columnNumber, int byteoffset, Node JavaDoc relatedData, String JavaDoc uri, int utf16Offset ){
103     fLineNumber = lineNumber ;
104     fColumnNumber = columnNumber ;
105     fByteOffset = byteoffset ;
106     fRelatedNode = relatedData ;
107     fUri = uri;
108     fUtf16Offset = utf16Offset;
109    } // DOMLocatorImpl (int lineNumber, int columnNumber, int offset, Node errorNode, String uri )
110

111
112   /**
113    * The line number where the error occured, or -1 if there is no line
114    * number available.
115    */

116    public int getLineNumber(){
117     return fLineNumber;
118    }
119
120   /**
121    * The column number where the error occured, or -1 if there is no column
122    * number available.
123    */

124   public int getColumnNumber(){
125     return fColumnNumber;
126   }
127
128
129   /**
130    * The URI where the error occured, or null if there is no URI available.
131    */

132   public String JavaDoc getUri(){
133     return fUri;
134   }
135
136
137   public Node JavaDoc getRelatedNode(){
138     return fRelatedNode;
139   }
140   
141
142   /**
143    * The byte offset into the input source this locator is pointing to or -1
144    * if there is no byte offset available
145    */

146   public int getByteOffset(){
147     return fByteOffset;
148   }
149
150   /**
151    * The UTF-16, as defined in [Unicode] and Amendment 1 of [ISO/IEC 10646],
152    * offset into the input source this locator is pointing to or -1 if there
153    * is no UTF-16 offset available.
154    */

155   public int getUtf16Offset(){
156     return fUtf16Offset;
157   }
158
159 }// class DOMLocatorImpl
160
Popular Tags