01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.xerces.util;
19:
20: import org.apache.xerces.xni.XMLLocator;
21: import org.xml.sax.Locator;
22: import org.xml.sax.ext.Locator2;
23:
24: /**
25: * Wraps {@link XMLLocator} and make it look like a SAX {@link Locator}.
26: *
27: * @author Arnaud Le Hors, IBM
28: * @author Andy Clark, IBM
29: *
30: * @version $Id: LocatorProxy.java 447241 2006-09-18 05:12:57Z mrglavas $
31: */
32: public class LocatorProxy implements Locator2 {
33:
34: //
35: // Data
36: //
37:
38: /** XML locator. */
39: private final XMLLocator fLocator;
40:
41: //
42: // Constructors
43: //
44:
45: /** Constructs an XML locator proxy. */
46: public LocatorProxy(XMLLocator locator) {
47: fLocator = locator;
48: }
49:
50: //
51: // Locator methods
52: //
53:
54: /** Public identifier. */
55: public String getPublicId() {
56: return fLocator.getPublicId();
57: }
58:
59: /** System identifier. */
60: public String getSystemId() {
61: return fLocator.getExpandedSystemId();
62: }
63:
64: /** Line number. */
65: public int getLineNumber() {
66: return fLocator.getLineNumber();
67: }
68:
69: /** Column number. */
70: public int getColumnNumber() {
71: return fLocator.getColumnNumber();
72: }
73:
74: //
75: // Locator2 methods
76: //
77:
78: public String getXMLVersion() {
79: return fLocator.getXMLVersion();
80: }
81:
82: public String getEncoding() {
83: return fLocator.getEncoding();
84: }
85:
86: }
|