Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5.dom » [javadoc | source]
org.apache.tapestry5.dom
public final class: Element [javadoc | source]
java.lang.Object
   org.apache.tapestry5.dom.Node
      org.apache.tapestry5.dom.Element
An element that will render with a begin tag and attributes, a body, and an end tag. Also acts as a factory for enclosed Element, Text and Comment nodes.

TODO: Support for CDATA nodes. Do we need Entity nodes?
Nested Class Summary:
class  Element.Attribute   
Constructor:
 Element(Document container,
    String namespace,
    String name) 
    Constructor for a root element.
 Element(Element parent,
    String namespace,
    String name) 
    Constructor for a nested element.
Method from org.apache.tapestry5.dom.Element Summary:
addClassName,   asElement,   attribute,   attribute,   attributes,   cdata,   comment,   defineNamespace,   element,   elementAt,   elementNS,   find,   forceAttributes,   getAttribute,   getDocument,   getElementById,   getName,   getNamespace,   getNamespaceURIToPrefix,   getParent,   pop,   raw,   removeChildren,   text,   toMarkup
Methods from org.apache.tapestry5.dom.Node:
addChild,   asElement,   clearChildren,   getChildMarkup,   getChildren,   getContainer,   getDocument,   getNamespaceURIToPrefix,   hasChildren,   indexOfNode,   insertChildAt,   moveAfter,   moveBefore,   moveToBottom,   moveToTop,   remove,   remove,   toMarkup,   toMarkup,   toString,   wrap,   writeChildMarkup
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tapestry5.dom.Element Detail:
 public Element addClassName(String className) 
    Adds one or more CSS class names to the "class" attribute. No check for duplicates is made. Note that CSS class names are case insensitive on the client.
 Element asElement() 
    All other implementations of Node return null except this one.
 public Element attribute(String name,
    String value) 
    Adds an attribute to the element, but only if the attribute name does not already exist.
 public Element attribute(String namespace,
    String name,
    String value) 
    Adds a namespaced attribute to the element, but only if the attribute name does not already exist.
 public Element attributes(String namesAndValues) 
 public CData cdata(String content) 
    Adds an returns a new CDATA node.
 public Element comment(String text) 
    Adds the comment and returns this element for further construction.
 public Element defineNamespace(String namespace,
    String namespacePrefix) 
    Defines a namespace for this element, mapping a URI to a prefix. This will affect how namespaced elements and attributes nested within the element are rendered, and will also cause xmlns: attributes (to define the namespace and prefix) to be rendered.
 public Element element(String name,
    String namesAndValues) 
    Creates and returns a new Element node as a child of this node.
 public Element elementAt(int index,
    String name,
    String namesAndValues) 
 public Element elementNS(String namespace,
    String name) 
    Creates and returns a new Element within a namespace as a child of this node.
 public Element find(String path) 
    Searchs for a child element with a particular name below this element. The path parameter is a slash separated series of element names.
 public Element forceAttributes(String namesAndValues) 
    Forces changes to a number of attributes. The new attributes overwrite previous values.
 public String getAttribute(String attributeName) 
 public Document getDocument() 
 public Element getElementById(String id) 
    Tries to find an element under this element (including itself) whose id is specified. Performs a width-first search of the document tree.
 public String getName() 
 public String getNamespace() 
    Returns the namespace for this element (which is typically a URL). The namespace may be null.
 protected Map<String, String> getNamespaceURIToPrefix() 
 public Element getParent() 
    Returns the containing element for this element. This will be null for the root element of a document.
 public  void pop() 
    Removes an element; the element's children take the place of the node within its container.
 public Element raw(String text) 
    Adds the raw text and returns this element for further construction.
 public Element removeChildren() 
    Removes all children from this element.
 public Text text(String text) 
  void toMarkup(Document document,
    PrintWriter writer,
    Map<String, String> containerNamespacePrefixToURI)