KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > xml > client > Document


1 /*
2  * Copyright 2006 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * 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, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.xml.client;
17
18 /*
19  * Implementation notes: Safari does not support mutable attributes, so no
20  * mechanism for creating Attr objects has been supplied. IE does not support
21  * any of the xxxNS operations, so they have been omitted as well. IE does not
22  * use importNode to copy nodes from one document into another.
23  */

24 /**
25  * <code>Document</code> objects represent XML documents. Each
26  * <code>Document</code> can contain exactly one <code>Element</code> node,
27  * and any number of other node types.
28  */

29 public interface Document extends Node {
30   /**
31    * This method creates a new <code>CDATASection</code>.
32    *
33    * @param data the data of the new <code>CDATASection</code>
34    * @return the newly created <code>CDATASection</code>
35    */

36   public CDATASection createCDATASection(String JavaDoc data);
37
38   /**
39    * This method creates a new <code>Comment</code>.
40    *
41    * @param data the data of the new <code>Comment</code>
42    * @return the newly created <code>Comment</code>
43    */

44   public Comment createComment(String JavaDoc data);
45
46   /**
47    * This method creates a new <code>DocumentFragment</code>.
48    *
49    * @return the newly created <code>DocumentFragment</code>
50    */

51   public DocumentFragment createDocumentFragment();
52
53   /**
54    * This method creates a new <code>Element</code>.
55    *
56    * @param tagName the tag name of the new <code>Element</code>
57    * @return the newly created <code>Element</code>
58    */

59   public Element createElement(String JavaDoc tagName);
60
61   /**
62    * This method creates a new <code>ProcessingInstruction</code>.
63    *
64    * @param target the target of the new <code>ProcessingInstruction</code>
65    * @param data the data of the new <code>ProcessingInstruction</code>
66    * @return the newly created <code>ProcessingInstruction</code>
67    */

68   public ProcessingInstruction createProcessingInstruction(String JavaDoc target,
69       String JavaDoc data);
70
71   /**
72    * This method creates a new <code>Text</code>.
73    *
74    * @param data the data of the new <code>Text</code>
75    * @return the newly created <code>Text</code>
76    */

77   public Text createTextNode(String JavaDoc data);
78
79   /**
80    * This method retrieves the document element. Each document has at most one
81    * <code>Element</code> as its direct child, and this node is returned if it
82    * exists. <code>null</code> is returned otherwise.
83    *
84    * @return the document element of this <code>Document</code>
85    */

86   public Element getDocumentElement();
87
88   /**
89    * This method retrieves the unique descendent elements which has an id of
90    * <code>elementId</code>. Note the attribute which is used as an ID must
91    * be supplied in the DTD of the document. It is not sufficient to give the
92    * <code>Element</code> to be retrieved an attribute named 'id'.
93    *
94    * @return the <code>Element</code> which has an id of
95    * <code>elementId</code> and belongs to this <code>Document</code>
96    */

97   public Element getElementById(String JavaDoc elementId);
98
99   /**
100    * This method retrieves any descendent elements which have a tag name of
101    * <code>tagname</code>.
102    *
103    * @return the <code>NodeList</code> of elements which has a tag name of
104    * <code>tagname</code> and belong to this <code>Document</code>
105    */

106   public NodeList getElementsByTagName(String JavaDoc tagname);
107
108   /**
109    * This method imports a node into the current <code>Document</code>.
110    *
111    * @param deep whether to recurse to children
112    * @return the node <code>Node</code> imported
113    */

114   public Node importNode(Node importedNode, boolean deep);
115 }
Popular Tags