KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > om > OMNode


1 /*
2 * Copyright 2004,2005 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */

16 package org.apache.axis2.om;
17
18 import javax.xml.stream.XMLStreamException;
19
20
21 /**
22  * Interface OMNode
23  */

24 public interface OMNode {
25     /**
26      * The node is an <code>Element</code>.
27      */

28     public static final short ELEMENT_NODE = 1;
29
30     /**
31      * The node is a <code>Text</code> node.
32      */

33     public static final short TEXT_NODE = 3;
34
35     /**
36      * The node is a <code>CDATASection</code>.
37      */

38     public static final short CDATA_SECTION_NODE = 4;
39
40     /**
41      * The node is a <code>Comment</code>.
42      */

43     public static final short COMMENT_NODE = 8;
44
45     public static final short BLOB_NODE = 8;
46
47     /**
48      * This method should return the immediate parent of the node.
49      * Parent is always an Element
50      *
51      * @return
52      * @throws OMException
53      */

54     public OMContainer getParent() throws OMException;
55
56     /**
57      * Method setParent
58      *
59      * @param element
60      */

61     public void setParent(OMContainer element);
62
63     /**
64      * This will give the next sibling. This can be an OMAttribute for OMAttribute or OMText or OMELement for others.
65      *
66      * @return
67      * @throws OMException
68      */

69     public OMNode getNextSibling() throws OMException;
70
71     /**
72      * Method setNextSibling
73      *
74      * @param node
75      */

76     public void setNextSibling(OMNode node);
77
78     /**
79      * this will indicate whether parser has parsed this information item completely or not.
80      * If somethings info are not available in the item, one has to check this attribute to make sure that, this
81      * item has been parsed completely or not.
82      *
83      * @return
84      */

85     public boolean isComplete();
86
87     /**
88      * Method setComplete
89      *
90      * @param state
91      */

92     public void setComplete(boolean state);
93
94     /**
95      * This will remove this information item and its children, from the model completely.
96      * Important to note that this method will detach the OMNode once it is fully built.
97      * Half built nodes are not to be detached!
98      * @throws OMException
99      */

100     public OMNode detach() throws OMException;
101
102     /**
103      * Discards a Node. Discrad goes to the parser level and if the element is not
104      * completely built, then it will be completely skipped at the parser level
105      * @throws OMException
106      */

107     public void discard() throws OMException;
108
109     /**
110      * This will insert a sibling just after the current information item.
111      * @param sibling
112      * @throws OMException
113      */

114     public void insertSiblingAfter(OMNode sibling) throws OMException;
115
116     /**
117      * This will insert a sibling just before the current information item
118      *
119      * @param sibling
120      * @throws OMException
121      */

122     public void insertSiblingBefore(OMNode sibling) throws OMException;
123
124     /**
125      * This is to get the type of node, as this is the super class of all the nodes
126      * @return
127      * @throws OMException
128      */

129     public int getType() throws OMException;
130
131     /**
132      * Method setType
133      * @param nodeType
134      * @throws OMException
135      */

136     public void setType(int nodeType) throws OMException;
137
138     /**
139      * get the previous sibling
140      * @return
141      */

142     public OMNode getPreviousSibling();
143
144     /**
145      * Set the previous sibling
146      * @param previousSibling
147      */

148     public void setPreviousSibling(OMNode previousSibling);
149
150     /**
151      * Serialize the node with caching
152      * @see #serializeWithCache(javax.xml.stream.XMLStreamWriter)
153      * @param writer
154      * @throws XMLStreamException
155      */

156     public void serializeWithCache(OMOutput omOutput)
157         throws XMLStreamException;
158
159     /**
160      * Serilaize the node without caching
161      * @see #serialize(javax.xml.stream.XMLStreamWriter)
162      * @param writer
163      * @throws XMLStreamException
164      */

165     public void serialize(OMOutput omOutput) throws XMLStreamException;
166
167     /**
168      * Builds itself
169      */

170     public void build();
171
172 }
173
Popular Tags