1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 package com.sun.org.apache.xerces.internal.impl.xs.util; 23 24 import com.sun.org.apache.xerces.internal.xni.XMLLocator; 25 26 /** 27 * An XMLLocator implementation used for schema error reporting. 28 * 29 * @xerces.internal 30 * 31 * @author Sandy Gao, IBM 32 */ 33 public class SimpleLocator implements XMLLocator { 34 35 String lsid, esid; 36 int line, column; 37 int charOffset; 38 39 public SimpleLocator() { 40 } 41 42 public SimpleLocator(String lsid, String esid, int line, int column) { 43 this(lsid, esid, line, column, -1); 44 } 45 46 public void setValues(String lsid, String esid, int line, int column) { 47 setValues(lsid, esid, line, column, -1); 48 } 49 50 public SimpleLocator(String lsid, String esid, int line, int column, int offset) { 51 this.line = line; 52 this.column = column; 53 this.lsid = lsid; 54 this.esid = esid; 55 charOffset = offset; 56 } 57 58 public void setValues(String lsid, String esid, int line, int column, int offset) { 59 this.line = line; 60 this.column = column; 61 this.lsid = lsid; 62 this.esid = esid; 63 charOffset = offset; 64 } 65 66 public int getLineNumber() { 67 return line; 68 } 69 70 public int getColumnNumber() { 71 return column; 72 } 73 74 public int getCharacterOffset() { 75 return charOffset; 76 } 77 78 public String getPublicId() { 79 return null; 80 } 81 82 public String getExpandedSystemId() { 83 return esid; 84 } 85 86 public String getLiteralSystemId() { 87 return lsid; 88 } 89 90 public String getBaseSystemId() { 91 return null; 92 } 93 /** 94 * @see com.sun.org.apache.xerces.internal.xni.XMLLocator#setColumnNumber(int) 95 */ 96 public void setColumnNumber(int col) { 97 this.column = col; 98 } 99 100 /** 101 * @see com.sun.org.apache.xerces.internal.xni.XMLLocator#setLineNumber(int) 102 */ 103 public void setLineNumber(int line) { 104 this.line = line; 105 } 106 107 public void setCharacterOffset(int offset) { 108 charOffset = offset; 109 } 110 111 /** 112 * @see com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier#setBaseSystemId(String) 113 */ 114 public void setBaseSystemId(String systemId) {} 115 116 /** 117 * @see com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier#setExpandedSystemId(String) 118 */ 119 public void setExpandedSystemId(String systemId) { 120 esid = systemId; 121 } 122 123 /** 124 * @see com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier#setLiteralSystemId(String) 125 */ 126 public void setLiteralSystemId(String systemId) { 127 lsid = systemId; 128 } 129 130 /** 131 * @see com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier#setPublicId(String) 132 */ 133 public void setPublicId(String publicId) {} 134 135 /** Returns the encoding of the current entity. 136 * Since these locators are used in the construction of 137 * XMLParseExceptions, which know nothing about encodings, there is 138 * no point in having this object deal intelligently 139 * with encoding information. 140 */ 141 public String getEncoding() { 142 return null; 143 } 144 145 public String getXMLVersion() { 146 return null; 147 } 148 }