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 22package com.sun.org.apache.xerces.internal.util; 23 24import com.sun.org.apache.xerces.internal.xni.XMLLocator; 25import org.xml.sax.Locator; 26import org.xml.sax.ext.Locator2; 27 28/** 29 * Wraps {@link XMLLocator} and make it look like a SAX {@link Locator}. 30 * 31 * @author Arnaud Le Hors, IBM 32 * @author Andy Clark, IBM 33 * 34 */ 35public class LocatorProxy implements Locator2 { 36 37 // 38 // Data 39 // 40 41 /** XML locator. */ 42 private final XMLLocator fLocator; 43 44 // 45 // Constructors 46 // 47 48 /** Constructs an XML locator proxy. */ 49 public LocatorProxy(XMLLocator locator) { 50 fLocator = locator; 51 } 52 53 // 54 // Locator methods 55 // 56 57 /** Public identifier. */ 58 public String getPublicId() { 59 return fLocator.getPublicId(); 60 } 61 62 /** System identifier. */ 63 public String getSystemId() { 64 return fLocator.getExpandedSystemId(); 65 } 66 67 /** Line number. */ 68 public int getLineNumber() { 69 return fLocator.getLineNumber(); 70 } 71 72 /** Column number. */ 73 public int getColumnNumber() { 74 return fLocator.getColumnNumber(); 75 } 76 77 // 78 // Locator2 methods 79 // 80 81 public String getXMLVersion() { 82 return fLocator.getXMLVersion(); 83 } 84 85 public String getEncoding() { 86 return fLocator.getEncoding(); 87 } 88 89} 90