KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xmlc > XMLObject


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: XMLObject.java,v 1.3 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.xmlc;
25
26 import org.enhydra.xml.io.DocumentInfo;
27 import org.w3c.dom.DOMException JavaDoc;
28 import org.w3c.dom.Document JavaDoc;
29 import org.w3c.dom.Node JavaDoc;
30
31 /**
32  * Interface for all compiled XML objects.
33  */

34 public interface XMLObject extends Document JavaDoc, DocumentInfo {
35     /**
36      * The name of the class field that is used to identify an XMLC
37      * generated class. The field will contain a reference to the
38      * Class object for the class. This is used to find the XMLC generated
39      * class in an inheritance hierarchy.
40      */

41     public static final String JavaDoc XMLC_GENERATED_CLASS_FIELD_NAME
42         = "XMLC_GENERATED_CLASS";
43
44     /**
45      * Field name in the generated class that contains the
46      * name of the source file. This is used to find
47      * the source file for recompilation. It is a relative
48      * file path, normally the name of the file within the
49      * package containing the class.
50      */

51     public static final String JavaDoc XMLC_SOURCE_FILE_FIELD_NAME
52         = "XMLC_SOURCE_FILE";
53
54     /**
55      * Generated method to build the DOM. This is normally call by the
56      * constructor. However, one of the generated constructors takes a boolean
57      * flag to indicate if this should be called automatically. This method
58      * may also be called to reinitialize the object to its empty state.
59      */

60     public void buildDocument();
61
62     /**
63      * Set the delegate object. Delegation is used to support automatic
64      * recompilation of documents into XMLC objects. If the delegate is
65      * not null, the methods of the delegate are called to handle most
66      * of the methods of this object.
67      *
68      * @param delegate The delegate object, or null to remove delegation.
69      * The delegate must implement the same interface as the derived, generate
70      * object.
71      */

72     public void setDelegate(XMLObject delegate);
73
74     /**
75      * Initialize the fields used by the generated access methods from the
76      * current state of the document. Missing DOM element ids will result in
77      * their acccess method returning <CODE>null</CODE>.
78      */

79     public void syncAccessMethods();
80
81     /**
82      * Get the delegate.
83      * @return The delegate object, or null if there is no delegate.
84      */

85     public XMLObject getDelegate();
86
87     /**
88      * Get the actual document object. One should normally just use the
89      * XMLObject methods to access the Document functionality, this is for the
90      * initialization of derived objects.
91      */

92     public Document JavaDoc getDocument();
93
94     /**
95      * Get the MIME type associated with the document, or null if none was
96      * associated.
97      */

98     public String JavaDoc getMIMEType();
99
100     /**
101      * Get the encoding specified in the document. Note that this is the
102      * symbolic name of the XML encoding, which is not the same as the
103      * Java encoding names.
104      *
105      * @return the encoding or null if no encoding was explicitly
106      * specified.
107      * @see org.enhydra.xml.io.DOMFormatter
108      * @see org.enhydra.xml.io.OutputOptions
109      */

110     public String JavaDoc getEncoding();
111
112     /**
113      * See org.w3c.dom.Document#setEncoding
114      */

115     public void setEncoding(String JavaDoc encoding);
116
117     /**
118      * See org.w3c.dom.Document#getStandalone
119      */

120     public boolean getStandalone();
121
122     /**
123      * See org.w3c.dom.Document#setStandalone
124      */

125     public void setStandalone(boolean standalone);
126     
127     /**
128      * See org.w3c.dom.Document#getStrictErrorChecking
129      */

130     public boolean getStrictErrorChecking();
131
132     /**
133      * See org.w3c.dom.Document#setStrictErrorChecking
134      */

135     public void setStrictErrorChecking(boolean strictErrorChecking);
136
137     /**
138      * See org.w3c.dom.Document#getVersion()
139      */

140     public String JavaDoc getVersion();
141
142     /**
143      * See org.w3c.dom.Document#setVersion
144      */

145     public void setVersion(String JavaDoc version);
146
147     /**
148      * See org.w3c.dom.Document#adoptNode
149      */

150     public Node JavaDoc adoptNode(Node JavaDoc source) throws DOMException JavaDoc;
151
152     /**
153      * Convert the document to a string representation of the document, that
154      * is a string containing XML. The results are parsable into the same
155      * DOM hierarchy. The formatting provided by this method does not
156      * begin to cover all of the issues involved with publishing
157      * a XML document, such as character encoding. Use the
158      * {@link org.enhydra.xml.io.DOMFormatter DOMFormatter} class if
159      * more options are required.
160      *
161      * @return A string containing the full XML.
162      * @see org.enhydra.xml.io.DOMFormatter
163      */

164     public String JavaDoc toDocument();
165 }
166
Popular Tags