1 /*
   2  * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.xml.transform;
  27 
  28 /**
  29  * This interface is primarily for the purposes of reporting where
  30  * an error occurred in the XML source or transformation instructions.
  31  */
  32 public interface SourceLocator {
  33 
  34     /**
  35      * Return the public identifier for the current document event.
  36      *
  37      * <p>The return value is the public identifier of the document
  38      * entity or of the external parsed entity in which the markup that
  39      * triggered the event appears.</p>
  40      *
  41      * @return A string containing the public identifier, or
  42      *         null if none is available.
  43      * @see #getSystemId
  44      */
  45     public String getPublicId();
  46 
  47     /**
  48      * Return the system identifier for the current document event.
  49      *
  50      * <p>The return value is the system identifier of the document
  51      * entity or of the external parsed entity in which the markup that
  52      * triggered the event appears.</p>
  53      *
  54      * <p>If the system identifier is a URL, the parser must resolve it
  55      * fully before passing it to the application.</p>
  56      *
  57      * @return A string containing the system identifier, or null
  58      *         if none is available.
  59      * @see #getPublicId
  60      */
  61     public String getSystemId();
  62 
  63     /**
  64      * Return the line number where the current document event ends.
  65      *
  66      * <p><strong>Warning:</strong> The return value from the method
  67      * is intended only as an approximation for the sake of error
  68      * reporting; it is not intended to provide sufficient information
  69      * to edit the character content of the original XML document.</p>
  70      *
  71      * <p>The return value is an approximation of the line number
  72      * in the document entity or external parsed entity where the
  73      * markup that triggered the event appears.</p>
  74      *
  75      * @return The line number, or -1 if none is available.
  76      * @see #getColumnNumber
  77      */
  78     public int getLineNumber();
  79 
  80     /**
  81      * Return the character position where the current document event ends.
  82      *
  83      * <p><strong>Warning:</strong> The return value from the method
  84      * is intended only as an approximation for the sake of error
  85      * reporting; it is not intended to provide sufficient information
  86      * to edit the character content of the original XML document.</p>
  87      *
  88      * <p>The return value is an approximation of the column number
  89      * in the document entity or external parsed entity where the
  90      * markup that triggered the event appears.</p>
  91      *
  92      * @return The column number, or -1 if none is available.
  93      * @see #getLineNumber
  94      */
  95     public int getColumnNumber();
  96 }