001: /*
002: * Copyright 1999-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id: NodeLocator.java,v 1.3 2004/02/16 23:06:11 minchau Exp $
018: */
019:
020: package org.apache.xml.dtm.ref;
021:
022: import javax.xml.transform.SourceLocator;
023:
024: /**
025: * <code>NodeLocator</code> maintains information on an XML source
026: * node.
027: *
028: * @author <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
029: * @since May 23, 2001
030: */
031: public class NodeLocator implements SourceLocator {
032: protected String m_publicId;
033: protected String m_systemId;
034: protected int m_lineNumber;
035: protected int m_columnNumber;
036:
037: /**
038: * Creates a new <code>NodeLocator</code> instance.
039: *
040: * @param publicId a <code>String</code> value
041: * @param systemId a <code>String</code> value
042: * @param lineNumber an <code>int</code> value
043: * @param columnNumber an <code>int</code> value
044: */
045: public NodeLocator(String publicId, String systemId,
046: int lineNumber, int columnNumber) {
047: this .m_publicId = publicId;
048: this .m_systemId = systemId;
049: this .m_lineNumber = lineNumber;
050: this .m_columnNumber = columnNumber;
051: }
052:
053: /**
054: * <code>getPublicId</code> returns the public ID of the node.
055: *
056: * @return a <code>String</code> value
057: */
058: public String getPublicId() {
059: return m_publicId;
060: }
061:
062: /**
063: * <code>getSystemId</code> returns the system ID of the node.
064: *
065: * @return a <code>String</code> value
066: */
067: public String getSystemId() {
068: return m_systemId;
069: }
070:
071: /**
072: * <code>getLineNumber</code> returns the line number of the node.
073: *
074: * @return an <code>int</code> value
075: */
076: public int getLineNumber() {
077: return m_lineNumber;
078: }
079:
080: /**
081: * <code>getColumnNumber</code> returns the column number of the
082: * node.
083: *
084: * @return an <code>int</code> value
085: */
086: public int getColumnNumber() {
087: return m_columnNumber;
088: }
089:
090: /**
091: * <code>toString</code> returns a string representation of this
092: * NodeLocator instance.
093: *
094: * @return a <code>String</code> value
095: */
096: public String toString() {
097: return "file '" + m_systemId + "', line #" + m_lineNumber
098: + ", column #" + m_columnNumber;
099: }
100: }
|