KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ditchnet > xml > Xml


1 /*
2  * The contents of this file are subject to the GNU Lesser General Public
3  * License Version 2.1 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of
5  * the License at http://www.gnu.org/copyleft/lesser.html
6  *
7  * Software distributed under the License is distributed on an "AS
8  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9  * implied. See the License for the specific language governing
10  * rights and limitations under the License.
11  *
12  * Developer:
13  * Todd Ditchendorf, todd@ditchnet.org
14  *
15  */

16
17 /**
18  * @author Todd Ditchendorf
19  * @since 2005-03-12
20  * @version 0.8
21  *
22  *
23  *
24  *
25  */

26 package org.ditchnet.xml;
27
28 /**
29  * <p>Some of the {@link org.ditchnet.jsp.util.JspResponseWriter} class'
30  * public instance methods write markup (XML, specifically) to the response
31  * stream. The <code>Xml</code> interface, it's static inner interfaces
32  * <code>Tag</code> and <code>Attr</code> enforce type-safety and decrease the
33  * likelyhood of malformed XML (which is not truely XML anyway) being
34  * generated by the JspResponseWriter class.</p>
35  * <p>For example the <code>JspResponseWriter</code>'s <code>startElement()</code>
36  * method accepts one parameter of type <code>Xml.Tag</code> instead of just a
37  * <code>String</code>. Again, this ensures type safety, but more importantly,
38  * allows a fixed set of markup elements to be sent to the response stream
39  * making XML well-formedness errors much less likely.</p>
40  * <p>This class is purely a utilitly class, and may not be instaciated
41  * by client code (private constructor).</p>
42  * <p>Note that the {@link org.ditchnet.xml.Xml.Tag} class implements
43  * the Type-Safe Enum Pattern as described by Joshua Bloch in <em>Effective
44  * Java</em>.</p>
45  * <p>Subclasses of this class should represent a specific XML vocabulary
46  * or application. For example, the {@link org.ditchnet.xml.Xhtml}
47  * class represents the XHTML vocabulary.</p>
48  *
49  *
50  *
51  * @author Todd Ditchendorf
52  *
53  *
54  */

55 public interface Xml {
56     
57     /**
58      * <p>This class implements the Type-Safe Enum pattern as outlined by
59      * Joshua Bloch in <em>Effective Java</em>. The only constructor is
60      * private, and therefore this class may not be instanciated by client
61      * code.</p>
62      * <p>Subclasses of this class will provide enumerations of valid
63      * elements allowed in a particular XML vocabulary or application.</p>
64      *
65      * @since 2005-03-12
66      * @version 0.8
67      * @author Todd Ditchendorf
68      *
69      */

70     public static interface Tag { }
71     
72     /**
73      * <p>Concrete implementations of this interface should impelement
74      * the Type-Safe Enum pattern as outlined by Joshua Bloch in
75      * <em>Effective Java</em> and provide static member variables that
76      * present the complete set of attribute names available in the
77      * XML vocabulary in question.</p>
78      *
79      * @since 2005-03-12
80      * @version 0.8
81      * @author Todd Ditchendorf
82      *
83      *
84      *
85      */

86     public static interface Attr { }
87     
88 }
89
Popular Tags