001: package com.quadcap.text.sax;
002:
003: /* Copyright 2000 - 2003 Quadcap Software. All rights reserved.
004: *
005: * This software is distributed under the Quadcap Free Software License.
006: * This software may be used or modified for any purpose, personal or
007: * commercial. Open Source redistributions are permitted. Commercial
008: * redistribution of larger works derived from, or works which bundle
009: * this software requires a "Commercial Redistribution License"; see
010: * http://www.quadcap.com/purchase.
011: *
012: * Redistributions qualify as "Open Source" under one of the following terms:
013: *
014: * Redistributions are made at no charge beyond the reasonable cost of
015: * materials and delivery.
016: *
017: * Redistributions are accompanied by a copy of the Source Code or by an
018: * irrevocable offer to provide a copy of the Source Code for up to three
019: * years at the cost of materials and delivery. Such redistributions
020: * must allow further use, modification, and redistribution of the Source
021: * Code under substantially the same terms as this license.
022: *
023: * Redistributions of source code must retain the copyright notices as they
024: * appear in each source code file, these license terms, and the
025: * disclaimer/limitation of liability set forth as paragraph 6 below.
026: *
027: * Redistributions in binary form must reproduce this Copyright Notice,
028: * these license terms, and the disclaimer/limitation of liability set
029: * forth as paragraph 6 below, in the documentation and/or other materials
030: * provided with the distribution.
031: *
032: * The Software is provided on an "AS IS" basis. No warranty is
033: * provided that the Software is free of defects, or fit for a
034: * particular purpose.
035: *
036: * Limitation of Liability. Quadcap Software shall not be liable
037: * for any damages suffered by the Licensee or any third party resulting
038: * from use of the Software.
039: */
040:
041: /**
042: * Locator implementation.
043: *
044: * @author Stan Bailes
045: */
046: public class Locator implements org.xml.sax.Locator {
047: Parser parser;
048:
049: public Locator(Parser parser) {
050: this .parser = parser;
051: }
052:
053: /**
054: * Return the public identifier for the current document event.
055: * <p>This will be the public identifier
056: * @return A string containing the public identifier, or
057: * null if none is available.
058: * @see #getSystemId
059: */
060: public String getPublicId() {
061: return parser.in.getPublicId();
062: }
063:
064: /**
065: * Return the system identifier for the current document event.
066: *
067: * <p>If the system identifier is a URL, the parser must resolve it
068: * fully before passing it to the application.</p>
069: *
070: * @return A string containing the system identifier, or null
071: * if none is available.
072: * @see #getPublicId
073: */
074: public String getSystemId() {
075: return parser.in.getSystemId();
076: }
077:
078: /**
079: * Return the line number where the current document event ends.
080: * Note that this is the line position of the first character
081: * after the text associated with the document event.
082: * @return The line number, or -1 if none is available.
083: * @see #getColumnNumber
084: */
085: public int getLineNumber() {
086: return parser.getLineNumber();
087: }
088:
089: /**
090: * Return the column number where the current document event ends.
091: * Note that this is the column number of the first
092: * character after the text associated with the document
093: * event. The first column in a line is position 1.
094: * @return The column number, or -1 if none is available.
095: * @see #getLineNumber
096: */
097: public int getColumnNumber() {
098: return parser.getColumnNumber();
099: }
100:
101: }
|