286N/A/*
286N/A * reserved comment block
286N/A * DO NOT REMOVE OR ALTER!
286N/A */
286N/A/*
286N/A * Licensed to the Apache Software Foundation (ASF) under one or more
286N/A * contributor license agreements. See the NOTICE file distributed with
286N/A * this work for additional information regarding copyright ownership.
286N/A * The ASF licenses this file to You under the Apache License, Version 2.0
286N/A * (the "License"); you may not use this file except in compliance with
286N/A * the License. You may obtain a copy of the License at
286N/A *
286N/A * http://www.apache.org/licenses/LICENSE-2.0
286N/A *
286N/A * Unless required by applicable law or agreed to in writing, software
286N/A * distributed under the License is distributed on an "AS IS" BASIS,
286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
286N/A * See the License for the specific language governing permissions and
286N/A * limitations under the License.
286N/A */
286N/A
286N/Apackage com.sun.org.apache.xerces.internal.util;
286N/A
286N/A
286N/Aimport javax.xml.stream.Location;
286N/A
286N/Aimport com.sun.org.apache.xerces.internal.xni.XMLLocator;
286N/A
286N/A/**
286N/A * <p>A light wrapper around a StAX location. This is useful
286N/A * when bridging between StAX and XNI components.</p>
286N/A *
286N/A * @author Michael Glavassevich, IBM
286N/A *
286N/A * @version $Id: StAXLocationWrapper.java,v 1.2 2010-10-26 23:01:13 joehw Exp $
286N/A */
286N/Apublic final class StAXLocationWrapper implements XMLLocator {
286N/A
286N/A private Location fLocation = null;
286N/A
286N/A public StAXLocationWrapper() {}
286N/A
286N/A public void setLocation(Location location) {
286N/A fLocation = location;
286N/A }
286N/A
286N/A public Location getLocation() {
286N/A return fLocation;
286N/A }
286N/A
286N/A /*
286N/A * XMLLocator methods
286N/A */
286N/A
286N/A public String getPublicId() {
286N/A if (fLocation != null) {
286N/A return fLocation.getPublicId();
286N/A }
286N/A return null;
286N/A }
286N/A
286N/A public String getLiteralSystemId() {
286N/A if (fLocation != null) {
286N/A return fLocation.getSystemId();
286N/A }
286N/A return null;
286N/A }
286N/A
286N/A public String getBaseSystemId() {
286N/A return null;
286N/A }
286N/A
286N/A public String getExpandedSystemId() {
286N/A return getLiteralSystemId();
286N/A }
286N/A
286N/A public int getLineNumber() {
286N/A if (fLocation != null) {
286N/A return fLocation.getLineNumber();
286N/A }
286N/A return -1;
286N/A }
286N/A
286N/A public int getColumnNumber() {
286N/A if (fLocation != null) {
286N/A return fLocation.getColumnNumber();
286N/A }
286N/A return -1;
286N/A }
286N/A
286N/A public int getCharacterOffset() {
286N/A if (fLocation != null) {
286N/A return fLocation.getCharacterOffset();
286N/A }
286N/A return -1;
286N/A }
286N/A
286N/A public String getEncoding() {
286N/A return null;
286N/A }
286N/A
286N/A public String getXMLVersion() {
286N/A return null;
286N/A }
286N/A
286N/A} // StAXLocationWrapper