001/* 002 * Position.java July 2006 003 * 004 * Copyright (C) 2006, Niall Gallagher <niallg@users.sf.net> 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 015 * implied. See the License for the specific language governing 016 * permissions and limitations under the License. 017 */ 018 019package org.simpleframework.xml.stream; 020 021/** 022 * The <code>Position</code> object is used to acquire the position 023 * of the read cursor within the XML file. This allows exceptions to 024 * be thrown with the line number so that the XML can be debugged. 025 * 026 * @author Niall Gallagher 027 */ 028public interface Position { 029 030 /** 031 * This is the actual line number within the read XML document. 032 * The line number allows any problems within the source XML 033 * document to be debugged if it does not match the schema. 034 * This will return -1 if the line number cannot be determined. 035 * 036 * @return this returns the line number of an XML event 037 */ 038 int getLine(); 039 040 /** 041 * This provides a textual description of the position the 042 * read cursor is at within the XML document. This allows the 043 * position to be embedded within the exception thrown. 044 * 045 * @return this returns a textual description of the position 046 */ 047 String toString(); 048}