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.util; 23 24 import com.sun.org.apache.xerces.internal.xni.XMLLocator; 25 26 /** 27 * <p>A light wrapper around an <code>XMLLocator</code>.</p> 28 * 29 * @author Michael Glavassevich, IBM 30 * 31 * @version $Id: XMLLocatorWrapper.java 533423 2007-04-28 20:47:15Z mrglavas $ 32 */ 33 public final class XMLLocatorWrapper implements XMLLocator { 34 35 private XMLLocator fLocator = null; 36 XMLLocatorWrapper()37 public XMLLocatorWrapper() {} 38 setLocator(XMLLocator locator)39 public void setLocator(XMLLocator locator) { 40 fLocator = locator; 41 } 42 getLocator()43 public XMLLocator getLocator() { 44 return fLocator; 45 } 46 47 /* 48 * XMLLocator methods 49 */ 50 getPublicId()51 public String getPublicId() { 52 if (fLocator != null) { 53 return fLocator.getPublicId(); 54 } 55 return null; 56 } 57 getLiteralSystemId()58 public String getLiteralSystemId() { 59 if (fLocator != null) { 60 return fLocator.getLiteralSystemId(); 61 } 62 return null; 63 } 64 getBaseSystemId()65 public String getBaseSystemId() { 66 if (fLocator != null) { 67 return fLocator.getBaseSystemId(); 68 } 69 return null; 70 } 71 getExpandedSystemId()72 public String getExpandedSystemId() { 73 if (fLocator != null) { 74 return fLocator.getExpandedSystemId(); 75 } 76 return null; 77 } 78 getLineNumber()79 public int getLineNumber() { 80 if (fLocator != null) { 81 return fLocator.getLineNumber(); 82 } 83 return -1; 84 } 85 getColumnNumber()86 public int getColumnNumber() { 87 if (fLocator != null) { 88 return fLocator.getColumnNumber(); 89 } 90 return -1; 91 } 92 getCharacterOffset()93 public int getCharacterOffset() { 94 if (fLocator != null) { 95 return fLocator.getCharacterOffset(); 96 } 97 return -1; 98 } 99 getEncoding()100 public String getEncoding() { 101 if (fLocator != null) { 102 return fLocator.getEncoding(); 103 } 104 return null; 105 } 106 getXMLVersion()107 public String getXMLVersion() { 108 if (fLocator != null) { 109 return fLocator.getXMLVersion(); 110 } 111 return null; 112 } 113 } 114