1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.xml;
24  
25  import java.util.Iterator;
26  import java.util.List;
27  import java.util.Map;
28  
29  /**
30   * <a href="Element.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   *
34   */
35  public interface Element extends Branch {
36  
37      public void add(Attribute attribute);
38  
39      public void add(CDATA cdata);
40  
41      public void add(Entity entity);
42  
43      public void add(Namespace namespace);
44  
45      public void add(Text text);
46  
47      public Element addAttribute(QName qName, String value);
48  
49      public Element addAttribute(String name, String value);
50  
51      public Element addCDATA(String cdata);
52  
53      public Element addComment(String comment);
54  
55      public Element addEntity(String name, String text);
56  
57      public List<Namespace> additionalNamespaces();
58  
59      public Element addNamespace(String prefix, String uri);
60  
61      public Element addProcessingInstruction(
62          String target, Map<String, String> data);
63  
64      public Element addProcessingInstruction(String target, String data);
65  
66      public Element addText(String text);
67  
68      public void appendAttributes(Element element);
69  
70      public Attribute attribute(int index);
71  
72      public Attribute attribute(QName qName);
73  
74      public Attribute attribute(String name);
75  
76      public int attributeCount();
77  
78      public Iterator<Attribute> attributeIterator();
79  
80      public List<Attribute> attributes();
81  
82      public String attributeValue(QName qName);
83  
84      public String attributeValue(QName qName, String defaultValue);
85  
86      public String attributeValue(String name);
87  
88      public String attributeValue(String name, String defaultValue);
89  
90      public Element createCopy();
91  
92      public Element createCopy(QName qName);
93  
94      public Element createCopy(String name);
95  
96      public List<Namespace> declaredNamespaces();
97  
98      public Element element(QName qName);
99  
100     public Element element(String name);
101 
102     public Iterator<Element> elementIterator();
103 
104     public Iterator<Element> elementIterator(QName qName);
105 
106     public Iterator<Element> elementIterator(String name);
107 
108     public List<Element> elements();
109 
110     public List<Element> elements(QName qName);
111 
112     public List<Element> elements(String name);
113 
114     public String elementText(QName qName);
115 
116     public String elementText(String name);
117 
118     public String elementTextTrim(QName qName);
119 
120     public String elementTextTrim(String name);
121 
122     public Object getData();
123 
124     public Namespace getNamespace();
125 
126     public Namespace getNamespaceForPrefix(String prefix);
127 
128     public Namespace getNamespaceForURI(String uri);
129 
130     public String getNamespacePrefix();
131 
132     public List<Namespace> getNamespacesForURI(String uri);
133 
134     public String getNamespaceURI();
135 
136     public QName getQName();
137 
138     public QName getQName(String qualifiedName);
139 
140     public String getQualifiedName();
141 
142     public String getStringValue();
143 
144     public String getText();
145 
146     public String getTextTrim();
147 
148     public Node getXPathResult(int index);
149 
150     public boolean hasMixedContent();
151 
152     public boolean isRootElement();
153 
154     public boolean isTextOnly();
155 
156     public boolean remove(Attribute attribute);
157 
158     public boolean remove(CDATA cdata);
159 
160     public boolean remove(Entity entity);
161 
162     public boolean remove(Namespace namespace);
163 
164     public boolean remove(Text text);
165 
166     public void setAttributes(List<Attribute> attributes);
167 
168     public void setData(Object data);
169 
170     public void setQName(QName qName);
171 
172 }