+++ /dev/null
-// SAX default implementation for Locator.\r
-// No warranty; no copyright -- use this as you will.\r
-// $Id: LocatorImpl.java,v 1.1 2000/10/02 02:43:20 sboag Exp $\r
-\r
-package org.xml.sax.helpers;\r
-\r
-import org.xml.sax.Locator;\r
-\r
-\r
-/**\r
- * Provide an optional convenience implementation of Locator.\r
- *\r
- * <blockquote>\r
- * <em>This module, both source code and documentation, is in the\r
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>\r
- * </blockquote>\r
- *\r
- * <p>This class is available mainly for application writers, who\r
- * can use it to make a persistent snapshot of a locator at any\r
- * point during a document parse:</p>\r
- *\r
- * <pre>\r
- * Locator locator;\r
- * Locator startloc;\r
- *\r
- * public void setLocator (Locator locator)\r
- * {\r
- * // note the locator\r
- * this.locator = locator;\r
- * }\r
- *\r
- * public void startDocument ()\r
- * {\r
- * // save the location of the start of the document\r
- * // for future use.\r
- * Locator startloc = new LocatorImpl(locator);\r
- * }\r
- *</pre>\r
- *\r
- * <p>Normally, parser writers will not use this class, since it\r
- * is more efficient to provide location information only when\r
- * requested, rather than constantly updating a Locator object.</p>\r
- *\r
- * @since SAX 1.0\r
- * @author David Megginson, \r
- * <a href="mailto:sax@megginson.com">sax@megginson.com</a>\r
- * @version 2.0\r
- * @see org.xml.sax.Locator Locator\r
- */\r
-public class LocatorImpl implements Locator\r
-{\r
- \r
- \r
- /**\r
- * Zero-argument constructor.\r
- *\r
- * <p>This will not normally be useful, since the main purpose\r
- * of this class is to make a snapshot of an existing Locator.</p>\r
- */\r
- public LocatorImpl ()\r
- {\r
- }\r
- \r
- \r
- /**\r
- * Copy constructor.\r
- *\r
- * <p>Create a persistent copy of the current state of a locator.\r
- * When the original locator changes, this copy will still keep\r
- * the original values (and it can be used outside the scope of\r
- * DocumentHandler methods).</p>\r
- *\r
- * @param locator The locator to copy.\r
- */\r
- public LocatorImpl (Locator locator)\r
- {\r
- setPublicId(locator.getPublicId());\r
- setSystemId(locator.getSystemId());\r
- setLineNumber(locator.getLineNumber());\r
- setColumnNumber(locator.getColumnNumber());\r
- }\r
- \r
- \r
-\f\r
- ////////////////////////////////////////////////////////////////////\r
- // Implementation of org.xml.sax.Locator\r
- ////////////////////////////////////////////////////////////////////\r
- \r
- \r
- /**\r
- * Return the saved public identifier.\r
- *\r
- * @return The public identifier as a string, or null if none\r
- * is available.\r
- * @see org.xml.sax.Locator#getPublicId\r
- * @see #setPublicId\r
- */\r
- public String getPublicId ()\r
- {\r
- return publicId;\r
- }\r
- \r
- \r
- /**\r
- * Return the saved system identifier.\r
- *\r
- * @return The system identifier as a string, or null if none\r
- * is available.\r
- * @see org.xml.sax.Locator#getSystemId\r
- * @see #setSystemId\r
- */\r
- public String getSystemId ()\r
- {\r
- return systemId;\r
- }\r
- \r
- \r
- /**\r
- * Return the saved line number (1-based).\r
- *\r
- * @return The line number as an integer, or -1 if none is available.\r
- * @see org.xml.sax.Locator#getLineNumber\r
- * @see #setLineNumber\r
- */\r
- public int getLineNumber ()\r
- {\r
- return lineNumber;\r
- }\r
- \r
- \r
- /**\r
- * Return the saved column number (1-based).\r
- *\r
- * @return The column number as an integer, or -1 if none is available.\r
- * @see org.xml.sax.Locator#getColumnNumber\r
- * @see #setColumnNumber\r
- */\r
- public int getColumnNumber ()\r
- {\r
- return columnNumber;\r
- }\r
- \r
- \r
-\f\r
- ////////////////////////////////////////////////////////////////////\r
- // Setters for the properties (not in org.xml.sax.Locator)\r
- ////////////////////////////////////////////////////////////////////\r
- \r
- \r
- /**\r
- * Set the public identifier for this locator.\r
- *\r
- * @param publicId The new public identifier, or null \r
- * if none is available.\r
- * @see #getPublicId\r
- */\r
- public void setPublicId (String publicId)\r
- {\r
- this.publicId = publicId;\r
- }\r
- \r
- \r
- /**\r
- * Set the system identifier for this locator.\r
- *\r
- * @param systemId The new system identifier, or null \r
- * if none is available.\r
- * @see #getSystemId\r
- */\r
- public void setSystemId (String systemId)\r
- {\r
- this.systemId = systemId;\r
- }\r
- \r
- \r
- /**\r
- * Set the line number for this locator (1-based).\r
- *\r
- * @param lineNumber The line number, or -1 if none is available.\r
- * @see #getLineNumber\r
- */\r
- public void setLineNumber (int lineNumber)\r
- {\r
- this.lineNumber = lineNumber;\r
- }\r
- \r
- \r
- /**\r
- * Set the column number for this locator (1-based).\r
- *\r
- * @param columnNumber The column number, or -1 if none is available.\r
- * @see #getColumnNumber\r
- */\r
- public void setColumnNumber (int columnNumber)\r
- {\r
- this.columnNumber = columnNumber;\r
- }\r
- \r
- \r
-\f\r
- ////////////////////////////////////////////////////////////////////\r
- // Internal state.\r
- ////////////////////////////////////////////////////////////////////\r
- \r
- private String publicId;\r
- private String systemId;\r
- private int lineNumber;\r
- private int columnNumber;\r
- \r
-}\r
-\r
-// end of LocatorImpl.java\r