KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xml > sax > ext > Locator2Impl


1 // Locator2Impl.java - extended LocatorImpl
2
// http://www.saxproject.org
3
// Public Domain: no warranty.
4
// $Id: Locator2Impl.java,v 1.1.2.1 2004/05/01 08:34:44 jsuttor Exp $
5

6 package org.xml.sax.ext;
7
8 import org.xml.sax.Locator JavaDoc;
9 import org.xml.sax.helpers.LocatorImpl JavaDoc;
10
11
12 /**
13  * SAX2 extension helper for holding additional Entity information,
14  * implementing the {@link Locator2} interface.
15  *
16  * <blockquote>
17  * <em>This module, both source code and documentation, is in the
18  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
19  * </blockquote>
20  *
21  * <p> This is not part of core-only SAX2 distributions.</p>
22  *
23  * @since SAX 2.0.2
24  * @author David Brownell
25  * @version TBS
26  */

27 public class Locator2Impl extends LocatorImpl JavaDoc implements Locator2 JavaDoc
28 {
29     private String JavaDoc encoding;
30     private String JavaDoc version;
31
32
33     /**
34      * Construct a new, empty Locator2Impl object.
35      * This will not normally be useful, since the main purpose
36      * of this class is to make a snapshot of an existing Locator.
37      */

38     public Locator2Impl () { }
39
40     /**
41      * Copy an existing Locator or Locator2 object.
42      * If the object implements Locator2, values of the
43      * <em>encoding</em> and <em>version</em>strings are copied,
44      * otherwise they set to <em>null</em>.
45      *
46      * @param locator The existing Locator object.
47      */

48     public Locator2Impl (Locator JavaDoc locator)
49     {
50     super (locator);
51     if (locator instanceof Locator2 JavaDoc) {
52         Locator2 JavaDoc l2 = (Locator2 JavaDoc) locator;
53
54         version = l2.getXMLVersion ();
55         encoding = l2.getEncoding ();
56     }
57     }
58
59     ////////////////////////////////////////////////////////////////////
60
// Locator2 method implementations
61
////////////////////////////////////////////////////////////////////
62

63     /**
64      * Returns the current value of the version property.
65      *
66      * @see #setXMLVersion
67      */

68     public String JavaDoc getXMLVersion ()
69     { return version; }
70
71     /**
72      * Returns the current value of the encoding property.
73      *
74      * @see #setEncoding
75      */

76     public String JavaDoc getEncoding ()
77     { return encoding; }
78
79
80     ////////////////////////////////////////////////////////////////////
81
// Setters
82
////////////////////////////////////////////////////////////////////
83

84     /**
85      * Assigns the current value of the version property.
86      *
87      * @param version the new "version" value
88      * @see #getXMLVersion
89      */

90     public void setXMLVersion (String JavaDoc version)
91     { this.version = version; }
92
93     /**
94      * Assigns the current value of the encoding property.
95      *
96      * @param encoding the new "encoding" value
97      * @see #getEncoding
98      */

99     public void setEncoding (String JavaDoc encoding)
100     { this.encoding = encoding; }
101 }
102
Popular Tags