net.sac.htmlwriter.element
Class Element

java.lang.Object
  extended by net.sac.htmlwriter.element.Element
Direct Known Subclasses:
A, Body, Br, Div, Head, Html, HtmlFragment, Li, ListElement, P, Script, Style, Table, TableCell, Tbody, TextFragment, Tfoot, Thead, Title, Tr

public abstract class Element
extends java.lang.Object


Field Summary
static java.lang.String[] ALLOWED_CHILD_TAGS_NONE
           
static java.lang.String[] ALLOWED_CHILD_TAGS_TEXT_ONLY
           
 
Constructor Summary
Element()
           
 
Method Summary
 void addAttribute(java.lang.String key, java.lang.String value)
          Deprecated. 
 void addChild(Element element)
           
 java.lang.String getAttribute(java.lang.String key)
           
 Element getChild(java.lang.String tagName, boolean recursive)
          Return the first child element of this element that has the given element name.
 int getChildIndex(java.lang.String tagName)
           
 java.util.List<Element> getChildren()
           
 java.lang.String getTagName()
           
 void insertChild(Element element, int index)
           
 void setAttribute(java.lang.String key, java.lang.String value)
           
 java.lang.String toHtml(boolean formatted, int depth, java.lang.String formattingSpacer)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOWED_CHILD_TAGS_NONE

public static final java.lang.String[] ALLOWED_CHILD_TAGS_NONE

ALLOWED_CHILD_TAGS_TEXT_ONLY

public static final java.lang.String[] ALLOWED_CHILD_TAGS_TEXT_ONLY
Constructor Detail

Element

public Element()
Method Detail

getTagName

public java.lang.String getTagName()

addChild

public void addChild(Element element)
              throws HtmlException
Throws:
HtmlException

insertChild

public void insertChild(Element element,
                        int index)
                 throws HtmlException
Throws:
HtmlException

addAttribute

@Deprecated
public void addAttribute(java.lang.String key,
                                    java.lang.String value)
Deprecated. 


setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.String value)

getAttribute

public java.lang.String getAttribute(java.lang.String key)

getChildIndex

public int getChildIndex(java.lang.String tagName)

getChild

public Element getChild(java.lang.String tagName,
                        boolean recursive)
Return the first child element of this element that has the given element name. If no element is found, null is returned.

Parameters:
tagName - tag name of child being searched for
recursive - if true, children of children will be searched recursively
Returns:

getChildren

public java.util.List<Element> getChildren()

toHtml

public java.lang.String toHtml(boolean formatted,
                               int depth,
                               java.lang.String formattingSpacer)