Class SimpleDOMBuilder


  • public class SimpleDOMBuilder
    extends java.lang.Object
    This class provides a simple way to create and populate a DOM tree in logical order
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean characters​(java.lang.String sText)
      Add characters to the currentElement.
      boolean endElement()
      Set the current element to the parent of the current element
      org.w3c.dom.Document getDOM()
      Get the DOM tree
      boolean setAttribute​(java.lang.String sName, java.lang.String sValue)
      Set an attribute of the current element
      boolean startElement​(java.lang.String sTagName)
      Append an element to the current element and set this new element to be the current element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleDOMBuilder

        public SimpleDOMBuilder()
    • Method Detail

      • startElement

        public boolean startElement​(java.lang.String sTagName)
        Append an element to the current element and set this new element to be the current element. If there is no current element, a new DOM tree will be created (discarding the current DOM tree if any) with the new element as the document element.
        Parameters:
        sTagName -
        Returns:
        true on success
      • endElement

        public boolean endElement()
        Set the current element to the parent of the current element
        Returns:
        true on success, false if there is no current element to end
      • setAttribute

        public boolean setAttribute​(java.lang.String sName,
                                    java.lang.String sValue)
        Set an attribute of the current element
        Parameters:
        sName -
        sValue -
        Returns:
        true on success, false if there is no current element
      • characters

        public boolean characters​(java.lang.String sText)
        Add characters to the currentElement. The actual writing of characters to the DOM is delayed until the startElement or endElement methods are invoked
        Parameters:
        sText -
        Returns:
        true on success, false if there is no current element
      • getDOM

        public org.w3c.dom.Document getDOM()
        Get the DOM tree
        Returns:
        the DOM tree, or null if none has been created