1/*
2 * Copyright (c) 2009, 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
26package javax.xml.stream;
27
28/**
29 * Provides information on the location of an event.
30 *
31 * All the information provided by a Location is optional.  For example
32 * an application may only report line numbers.
33 *
34 * @version 1.0
35 * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
36 * @since 1.6
37 */
38public interface Location {
39  /**
40   * Return the line number where the current event ends,
41   * returns -1 if none is available.
42   * @return the current line number
43   */
44  int getLineNumber();
45
46  /**
47   * Return the column number where the current event ends,
48   * returns -1 if none is available.
49   * @return the current column number
50   */
51  int getColumnNumber();
52
53  /**
54   * Return the byte or character offset into the input source this location
55   * is pointing to. If the input source is a file or a byte stream then
56   * this is the byte offset into that stream, but if the input source is
57   * a character media then the offset is the character offset.
58   * Returns -1 if there is no offset available.
59   * @return the current offset
60   */
61  int getCharacterOffset();
62
63  /**
64   * Returns the public ID of the XML
65   * @return the public ID, or null if not available
66   */
67  public String getPublicId();
68
69  /**
70   * Returns the system ID of the XML
71   * @return the system ID, or null if not available
72   */
73  public String getSystemId();
74}
75