Class XMLDOMWriter

java.lang.Object
com.scroogexhtml.converter.AbstractWriter
com.scroogexhtml.xmldom.XMLDOMWriter
All Implemented Interfaces:
BorderPropertiesWriter, CharacterPropertiesWriter, DocumentWriter, FieldWriter, FootnoteWriter, HeaderFooterWriter, PageSetupWriter, ParagraphPropertiesWriter, TableStateWriter, Writer

public final class XMLDOMWriter extends AbstractWriter
Writer implementation which uses javax.xml to build a DOM tree.

The converter uses a XMLDOMWriter to store the current RTF state, character properties and paragraph properties, and to build a Document.

  • Constructor Details

    • XMLDOMWriter

      public XMLDOMWriter(ConversionConfiguration configuration, HtmlHeadConfiguration htmlHeadConfig, TablePropConfiguration tablePropConfig, Charset charset)
      Initializes an instance of the XMLDOMWriter class with the given parameters.
      Parameters:
      configuration - The conversion configuration.
      htmlHeadConfig - The HTML head configuration.
      tablePropConfig - The table property configuration.
      charset - The character set.
  • Method Details

    • getTableWriter

      public TableWriter getTableWriter()
    • add

      public void add(char value)
      Description copied from interface: DocumentWriter
      Adds a character to the document.
      Parameters:
      value - the character to add
    • add

      public void add(String value)
      Description copied from interface: DocumentWriter
      Adds a string to the document.
      Parameters:
      value - the string to be added to the document
    • addLinebreak

      public void addLinebreak()
      Description copied from interface: DocumentWriter
      Adds a line break to the document.
    • writeTab

      public void writeTab()
    • applyTextProperties

      public void applyTextProperties()
      Description copied from interface: Writer
      Applies the text properties to the current document writer. This method should be called after any text property is changed. The properties include font style, color, background color, underline, highlight color, etc. The current document writer is responsible for applying these properties to the document.
    • applyParagraphProperties

      public void applyParagraphProperties()
      Description copied from interface: Writer
      Applies the paragraph properties to the document.
    • getCurrentFieldExpression

      public StringBuilder getCurrentFieldExpression()
      Description copied from interface: FieldWriter
      Retrieve the current field expression.
      Returns:
      the current field expression as a StringBuilder object
    • finishFldInst

      public void finishFldInst()
      Description copied from interface: FieldWriter
      Finishes the field instruction.

      This method is called to indicate that the field instruction has finished processing. It is typically called when leaving the Destination.DG_FLDINST destination in the RTF document.

    • finishFldRslt

      public void finishFldRslt()
      Description copied from interface: FieldWriter
      Finish the field result.
    • finishField

      public void finishField()
      Description copied from interface: FieldWriter
      Finish the current field expression.
    • setFieldExpression

      public void setFieldExpression(String value)
      Description copied from interface: FieldWriter
      Sets the field expression for the current field being written. The field expression is a string value that represents the type of field and any additional parameters. For example, "HYPERLINK index.html" is a field expression.
      Parameters:
      value - the field expression to set
    • appendStyleAttribute

      public static void appendStyleAttribute(Element element, String value)
      Appends a style attribute with the specified value to the given XML element.
      Parameters:
      element - the XML element to which the style attribute is to be appended
      value - the value of the style attribute to append
    • appendAttribute

      public static void appendAttribute(Element element, Attribute attr, String value)
      Appends an attribute with the given name and value to the specified element if the attribute does not already contain the value.
      Parameters:
      element - the element to append the attribute to
      attr - the attribute
      value - the value of the attribute to be appended
    • addPicture

      public void addPicture(EmbeddedPicture picture)
    • setFontName

      public void setFontName(String newValue)
      Description copied from interface: CharacterPropertiesWriter
      Sets the font name for the character properties.
      Specified by:
      setFontName in interface CharacterPropertiesWriter
      Overrides:
      setFontName in class AbstractWriter
      Parameters:
      newValue - the new font name
    • getResult

      public String getResult()
    • addAutoFootnoteRef

      public void addAutoFootnoteRef()
    • tableCellEnds

      public void tableCellEnds()
      Description copied from interface: TableStateWriter
      Ends the current cell in a table.

      This method is used to mark the end of the current cell when writing tables.

    • setNumberingStyle

      public void setNumberingStyle(boolean value)
    • setNumberingLevel

      public void setNumberingLevel(NumberingLevel newValue)
    • setListLevel

      public void setListLevel(int value)
    • setListOverrideIndex

      public void setListOverrideIndex(int listOverrideIndex)
    • writeEof

      public void writeEof()
    • footerStart

      public void footerStart(int footerType)
    • headerStart

      public void headerStart(int headerType)
      Description copied from interface: HeaderFooterWriter
      This method starts writing a header of the specified type.
      Parameters:
      headerType - the type of the header
    • footerEnd

      public void footerEnd()
    • nestedTableRowEnds

      public void nestedTableRowEnds()
      Description copied from interface: TableStateWriter
      Ends a nested table row.

      This method is used to mark the end of a nested table row when writing tables.

      See Also:
    • nestedTableCellEnds

      public void nestedTableCellEnds()
      Description copied from interface: TableStateWriter
      Ends the current cell in a nested table.
    • headerEnd

      public void headerEnd()
      Description copied from interface: HeaderFooterWriter
      Ends the header section.