Class XMLRenderer

java.lang.Object
org.deltava.taglib.XMLRenderer

public class XMLRenderer extends Object
A helper class to generate XML elements with attributes.
Since:
1.0
Version:
5.0
Author:
Luke
  • Constructor Details

    • XMLRenderer

      public XMLRenderer(String name)
      Creates a new XML element, with a lowercase name.
      Parameters:
      name - the element nam
      Throws:
      NullPointerException - if name is null
  • Method Details

    • getName

      public String getName()
      Returns the XML element name.
      Returns:
      the element name
    • has

      public boolean has(String name)
      Returns whether the element has a particular attribute.
      Parameters:
      name - the attribute name
      Returns:
      TRUE if the attribute exists, otherwise FALSE
    • clear

      public void clear()
      Clears all element attributes.
    • remove

      public void remove(String name)
      Removes an attribute from the element.
      Parameters:
      name - the attribute name
    • setAttribute

      public void setAttribute(String name, String value)
      Sets an element attribute.
      Parameters:
      name - the attribute name
      value - the attribute value
    • get

      public String get(String name)
      Gets an element attribute.
      Parameters:
      name - the attribute name
      Returns:
      the attribute value, or null if none
    • open

      public String open(boolean completeTag, boolean finishTag)
      Renders the open element tag as XML.
      Parameters:
      completeTag - TRUE if the tag should be completed, otherwise FALSE
      finishTag - TRUE if the tag should be finished, otherwise FALSE
      Returns:
      the element rendered to XML
    • open

      public String open(boolean completeTag)
      Renders the open element tag as XML.
      Parameters:
      completeTag - TRUE if the tag should be completed, otherwise FALSE
      Returns:
      the element rendered to XML
    • close

      public String close()
      Renders the close element tag as XML.
      Returns:
      the close tag