001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.xml;
016    
017    import java.util.Iterator;
018    import java.util.List;
019    import java.util.Map;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public interface Element extends Branch {
025    
026            public void add(Attribute attribute);
027    
028            public void add(CDATA cdata);
029    
030            public void add(Entity entity);
031    
032            public void add(Namespace namespace);
033    
034            public void add(Text text);
035    
036            public Element addAttribute(QName qName, String value);
037    
038            public Element addAttribute(String name, String value);
039    
040            public Element addCDATA(String cdata);
041    
042            public Element addComment(String comment);
043    
044            public Element addEntity(String name, String text);
045    
046            public List<Namespace> additionalNamespaces();
047    
048            public Element addNamespace(String prefix, String uri);
049    
050            public Element addProcessingInstruction(
051                    String target, Map<String, String> data);
052    
053            public Element addProcessingInstruction(String target, String data);
054    
055            public Element addText(String text);
056    
057            public void appendAttributes(Element element);
058    
059            public Attribute attribute(int index);
060    
061            public Attribute attribute(QName qName);
062    
063            public Attribute attribute(String name);
064    
065            public int attributeCount();
066    
067            public Iterator<Attribute> attributeIterator();
068    
069            public List<Attribute> attributes();
070    
071            public String attributeValue(QName qName);
072    
073            public String attributeValue(QName qName, String defaultValue);
074    
075            public String attributeValue(String name);
076    
077            public String attributeValue(String name, String defaultValue);
078    
079            public Element createCopy();
080    
081            public Element createCopy(QName qName);
082    
083            public Element createCopy(String name);
084    
085            public List<Namespace> declaredNamespaces();
086    
087            public Element element(QName qName);
088    
089            public Element element(String name);
090    
091            public Iterator<Element> elementIterator();
092    
093            public Iterator<Element> elementIterator(QName qName);
094    
095            public Iterator<Element> elementIterator(String name);
096    
097            public List<Element> elements();
098    
099            public List<Element> elements(QName qName);
100    
101            public List<Element> elements(String name);
102    
103            public String elementText(QName qName);
104    
105            public String elementText(String name);
106    
107            public String elementTextTrim(QName qName);
108    
109            public String elementTextTrim(String name);
110    
111            public Object getData();
112    
113            public Namespace getNamespace();
114    
115            public Namespace getNamespaceForPrefix(String prefix);
116    
117            public Namespace getNamespaceForURI(String uri);
118    
119            public String getNamespacePrefix();
120    
121            public List<Namespace> getNamespacesForURI(String uri);
122    
123            public String getNamespaceURI();
124    
125            public QName getQName();
126    
127            public QName getQName(String qualifiedName);
128    
129            public String getQualifiedName();
130    
131            public String getStringValue();
132    
133            public String getText();
134    
135            public String getTextTrim();
136    
137            public Node getXPathResult(int index);
138    
139            public boolean hasMixedContent();
140    
141            public boolean isRootElement();
142    
143            public boolean isTextOnly();
144    
145            public boolean remove(Attribute attribute);
146    
147            public boolean remove(CDATA cdata);
148    
149            public boolean remove(Entity entity);
150    
151            public boolean remove(Namespace namespace);
152    
153            public boolean remove(Text text);
154    
155            public void setAttributes(List<Attribute> attributes);
156    
157            public void setData(Object data);
158    
159            public void setQName(QName qName);
160    
161    }