1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *     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 // $Id: SourceLocator.java 446598 2006-09-15 12:55:40Z jeremias $
19 
20 package javax.xml.transform;
21 
22 /**
23  * This interface is primarily for the purposes of reporting where
24  * an error occurred in the XML source or transformation instructions.
25  */
26 public interface SourceLocator {
27 
28     /**
29      * Return the public identifier for the current document event.
30      *
31      * <p>The return value is the public identifier of the document
32      * entity or of the external parsed entity in which the markup that
33      * triggered the event appears.</p>
34      *
35      * @return A string containing the public identifier, or
36      *         null if none is available.
37      * @see #getSystemId
38      */
getPublicId()39     public String getPublicId();
40 
41     /**
42      * Return the system identifier for the current document event.
43      *
44      * <p>The return value is the system identifier of the document
45      * entity or of the external parsed entity in which the markup that
46      * triggered the event appears.</p>
47      *
48      * <p>If the system identifier is a URL, the parser must resolve it
49      * fully before passing it to the application.</p>
50      *
51      * @return A string containing the system identifier, or null
52      *         if none is available.
53      * @see #getPublicId
54      */
getSystemId()55     public String getSystemId();
56 
57     /**
58      * Return the line number where the current document event ends.
59      *
60      * <p><strong>Warning:</strong> The return value from the method
61      * is intended only as an approximation for the sake of error
62      * reporting; it is not intended to provide sufficient information
63      * to edit the character content of the original XML document.</p>
64      *
65      * <p>The return value is an approximation of the line number
66      * in the document entity or external parsed entity where the
67      * markup that triggered the event appears.</p>
68      *
69      * @return The line number, or -1 if none is available.
70      * @see #getColumnNumber
71      */
getLineNumber()72     public int getLineNumber();
73 
74     /**
75      * Return the character position where the current document event ends.
76      *
77      * <p><strong>Warning:</strong> The return value from the method
78      * is intended only as an approximation for the sake of error
79      * reporting; it is not intended to provide sufficient information
80      * to edit the character content of the original XML document.</p>
81      *
82      * <p>The return value is an approximation of the column number
83      * in the document entity or external parsed entity where the
84      * markup that triggered the event appears.</p>
85      *
86      * @return The column number, or -1 if none is available.
87      * @see #getLineNumber
88      */
getColumnNumber()89     public int getColumnNumber();
90 }
91