KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > xs > util > SimpleLocator


1 /*
2  * Copyright 2002, 2003,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.impl.xs.util;
18
19 import org.apache.xerces.xni.XMLLocator;
20
21 /**
22  * An XMLLocator implementation used for schema error reporting.
23  *
24  * @xerces.internal
25  *
26  * @author Sandy Gao, IBM
27  * @version $Id: SimpleLocator.java,v 1.7 2004/10/06 15:14:50 mrglavas Exp $
28  */

29 public class SimpleLocator implements XMLLocator {
30
31     String JavaDoc lsid, esid;
32     int line, column;
33     int charOffset;
34     
35     public SimpleLocator() {
36     }
37     
38     public SimpleLocator(String JavaDoc lsid, String JavaDoc esid, int line, int column) {
39         this(lsid, esid, line, column, -1);
40     }
41     
42     public void setValues(String JavaDoc lsid, String JavaDoc esid, int line, int column) {
43         setValues(lsid, esid, line, column, -1);
44     }
45     
46     public SimpleLocator(String JavaDoc lsid, String JavaDoc esid, int line, int column, int offset) {
47         this.line = line;
48         this.column = column;
49         this.lsid = lsid;
50         this.esid = esid;
51         charOffset = offset;
52     }
53     
54     public void setValues(String JavaDoc lsid, String JavaDoc esid, int line, int column, int offset) {
55         this.line = line;
56         this.column = column;
57         this.lsid = lsid;
58         this.esid = esid;
59         charOffset = offset;
60     }
61     
62     public int getLineNumber() {
63         return line;
64     }
65     
66     public int getColumnNumber() {
67         return column;
68     }
69     
70     public int getCharacterOffset() {
71         return charOffset;
72     }
73     
74     public String JavaDoc getPublicId() {
75         return null;
76     }
77     
78     public String JavaDoc getExpandedSystemId() {
79         return esid;
80     }
81     
82     public String JavaDoc getLiteralSystemId() {
83         return lsid;
84     }
85     
86     public String JavaDoc getBaseSystemId() {
87         return null;
88     }
89     /**
90      * @see org.apache.xerces.xni.XMLLocator#setColumnNumber(int)
91      */

92     public void setColumnNumber(int col) {
93         this.column = col;
94     }
95     
96     /**
97      * @see org.apache.xerces.xni.XMLLocator#setLineNumber(int)
98      */

99     public void setLineNumber(int line) {
100         this.line = line;
101     }
102     
103     public void setCharacterOffset(int offset) {
104         charOffset = offset;
105     }
106     
107     /**
108      * @see org.apache.xerces.xni.XMLResourceIdentifier#setBaseSystemId(String)
109      */

110     public void setBaseSystemId(String JavaDoc systemId) {}
111     
112     /**
113      * @see org.apache.xerces.xni.XMLResourceIdentifier#setExpandedSystemId(String)
114      */

115     public void setExpandedSystemId(String JavaDoc systemId) {
116         esid = systemId;
117     }
118     
119     /**
120      * @see org.apache.xerces.xni.XMLResourceIdentifier#setLiteralSystemId(String)
121      */

122     public void setLiteralSystemId(String JavaDoc systemId) {
123         lsid = systemId;
124     }
125     
126     /**
127      * @see org.apache.xerces.xni.XMLResourceIdentifier#setPublicId(String)
128      */

129     public void setPublicId(String JavaDoc publicId) {}
130     
131     /** Returns the encoding of the current entity.
132      * Since these locators are used in the construction of
133      * XMLParseExceptions, which know nothing about encodings, there is
134      * no point in having this object deal intelligently
135      * with encoding information.
136      */

137     public String JavaDoc getEncoding() {
138         return null;
139     }
140     
141     public String JavaDoc getXMLVersion() {
142         return null;
143     }
144 }
145
Popular Tags