KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xml > dtm > ref > NodeLocator


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: NodeLocator.java,v 1.3 2004/02/16 23:06:11 minchau Exp $
18  */

19
20 package org.apache.xml.dtm.ref;
21
22 import javax.xml.transform.SourceLocator JavaDoc;
23
24 /**
25  * <code>NodeLocator</code> maintains information on an XML source
26  * node.
27  *
28  * @author <a HREF="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
29  * @since May 23, 2001
30  */

31 public class NodeLocator implements SourceLocator JavaDoc
32 {
33   protected String JavaDoc m_publicId;
34   protected String JavaDoc m_systemId;
35   protected int m_lineNumber;
36   protected int m_columnNumber;
37
38   /**
39    * Creates a new <code>NodeLocator</code> instance.
40    *
41    * @param publicId a <code>String</code> value
42    * @param systemId a <code>String</code> value
43    * @param lineNumber an <code>int</code> value
44    * @param columnNumber an <code>int</code> value
45    */

46   public NodeLocator(String JavaDoc publicId, String JavaDoc systemId,
47                      int lineNumber, int columnNumber)
48   {
49     this.m_publicId = publicId;
50     this.m_systemId = systemId;
51     this.m_lineNumber = lineNumber;
52     this.m_columnNumber = columnNumber;
53   }
54
55   /**
56    * <code>getPublicId</code> returns the public ID of the node.
57    *
58    * @return a <code>String</code> value
59    */

60   public String JavaDoc getPublicId()
61   {
62     return m_publicId;
63   }
64
65   /**
66    * <code>getSystemId</code> returns the system ID of the node.
67    *
68    * @return a <code>String</code> value
69    */

70   public String JavaDoc getSystemId()
71   {
72     return m_systemId;
73   }
74
75   /**
76    * <code>getLineNumber</code> returns the line number of the node.
77    *
78    * @return an <code>int</code> value
79    */

80   public int getLineNumber()
81   {
82     return m_lineNumber;
83   }
84
85   /**
86    * <code>getColumnNumber</code> returns the column number of the
87    * node.
88    *
89    * @return an <code>int</code> value
90    */

91   public int getColumnNumber()
92   {
93     return m_columnNumber;
94   }
95
96   /**
97    * <code>toString</code> returns a string representation of this
98    * NodeLocator instance.
99    *
100    * @return a <code>String</code> value
101    */

102   public String JavaDoc toString()
103   {
104     return "file '" + m_systemId
105       + "', line #" + m_lineNumber
106       + ", column #" + m_columnNumber;
107   }
108 }
109
Popular Tags