java.lang.Object
fr.opensagres.xdocreport.document.preprocessor.sax.BufferedElement
All Implemented Interfaces:
IBufferedRegion, ISavable
Direct Known Subclasses:
BufferedDocument, RowBufferedRegion, TableBufferedRegion

public class BufferedElement extends Object implements IBufferedRegion
Buffered element which stores start Tag element (ex: ) and end Tag element (ex: ). The start Tag element stores too the BufferedElement children.
  • Field Details

  • Constructor Details

  • Method Details

    • match

      public boolean match(String name)
      Returns true if the given name match the name of this element and false otherwise.
      Parameters:
      name -
      Returns:
    • getStartTagElement

      public BufferedStartTagElement getStartTagElement()
      Returns the buffer of the start tag element.
      Returns:
    • getEndTagElement

      public BufferedEndTagElement getEndTagElement()
      Returns the buffer of the end tag element.
      Returns:
    • setContentBeforeStartTagElement

      public void setContentBeforeStartTagElement(String before)
      Set content on the before start tag element.
      Parameters:
      before -
    • setContentAfterEndTagElement

      public void setContentAfterEndTagElement(String after)
      Set content on the after end tag element.
      Parameters:
      before -
    • getParent

      public BufferedElement getParent()
      Returns the parent buffered element of this element.
      Specified by:
      getParent in interface IBufferedRegion
      Returns:
    • save

      public void save(Writer writer) throws IOException
      Write the content of this element in the given writer.
      Specified by:
      save in interface ISavable
      Throws:
      IOException
    • addRegion

      public void addRegion(ISavable region)
      Add a savable region in the current tag element.
      Specified by:
      addRegion in interface IBufferedRegion
    • isString

      public boolean isString()
      Returns false
      Specified by:
      isString in interface IBufferedRegion
      Returns:
    • append

      public void append(String content)
      Append content in the current tag element.
      Specified by:
      append in interface IBufferedRegion
    • append

      public void append(char[] ch, int start, int length)
      Append content in the current tag element.
      Specified by:
      append in interface IBufferedRegion
    • append

      public void append(char c)
      Append content in the current tag element.
      Specified by:
      append in interface IBufferedRegion
    • reset

      public void reset()
      Reset the whole content of the element.
    • isReseted

      public boolean isReseted()
    • removeAll

      public void removeAll(Collection<BufferedElement> elements)
      Remove the collection of element.
      Parameters:
      elements -
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getOwnerElement

      public BufferedElement getOwnerElement()
      Returns the owner element.
      Specified by:
      getOwnerElement in interface ISavable
      Returns:
    • findParent

      public BufferedElement findParent(String name)
      Returns the parent element of this element which match the given name.
      Parameters:
      element -
      name -
      Returns:
    • findParent

      public BufferedElement findParent(BufferedElement element, String name)
      Returns the parent element of the given element which match the given name.
      Parameters:
      element -
      name -
      Returns:
    • findChildren

      public List<BufferedElement> findChildren(String name)
      Returns the children element of this element which match the given name.
      Parameters:
      name -
      Returns:
    • findChildren

      public List<BufferedElement> findChildren(BufferedElement element, String name)
      Returns the children element of the given element which match the given name.
      Parameters:
      element -
      name -
      Returns:
    • findFirstChild

      public BufferedElement findFirstChild(String name)
      Returns the first child element of the given element which match the given name and null otherwise.
      Parameters:
      name -
      Returns:
    • findFirstChild

      public BufferedElement findFirstChild(BufferedElement element, String name)
      Returns the first child element of this element which match the given name and null otherwise.
      Parameters:
      name -
      Returns:
    • findChildAt

      public BufferedElement findChildAt(String name, int index)
      Returns the first child element of the given element which match the given name and null otherwise.
      Parameters:
      name -
      Returns:
    • findChildAt

      public BufferedElement findChildAt(BufferedElement element, String name, int index)
      Returns the first child element of this element which match the given name and null otherwise.
      Parameters:
      name -
      Returns:
    • start

      public void start()
      Set the current buffer with start tag element.
    • end

      public void end()
      Set the current buffer with end tag element.
    • isEnded

      public boolean isEnded()
      Returns true if current buffer is end tag element and false otherwise.
      Returns:
    • getStartTagElementName

      public String getStartTagElementName()
      Returns the name of this start tag element (ex : <w:t>).
      Returns:
    • getEndTagElementName

      public String getEndTagElementName()
      Returns the name of this end tag element (ex : </w:t>).
      Returns:
    • setTextContent

      public void setTextContent(String content)
      Set text content for this element.
      Parameters:
      content -
    • getTextContent

      public String getTextContent()
      Returns the text content for this element.
      Returns:
    • getAttributes

      public Attributes getAttributes()
      Returns the static SAX attributes.
      Returns:
    • registerDynamicAttributes

      public void registerDynamicAttributes()
      Register dynamic attributes if needed.
    • setAttribute

      public BufferedAttribute setAttribute(String name, String value)
      Set dynamic attribute.
      Parameters:
      name -
      value -
      Returns:
    • getName

      public String getName()
    • getInnerText

      public String getInnerText()
    • setInnerText

      public void setInnerText(String innerText)
    • get

      public String get(String key)
    • put

      public void put(String key, String value)