Class XMLBuilder

java.lang.Object
org.eclipse.lemminx.utils.XMLBuilder

public class XMLBuilder extends Object
XML content builder utilities.
  • Constructor Details

  • Method Details

    • appendSpace

      public XMLBuilder appendSpace()
    • startElement

      public XMLBuilder startElement(String prefix, String name, boolean close)
    • startElement

      public XMLBuilder startElement(String name, boolean close)
    • endElement

      public XMLBuilder endElement(String name, boolean isEndTagClosed)
    • endElement

      public XMLBuilder endElement(String name)
    • endElement

      public XMLBuilder endElement(String prefix, String name)
    • endElement

      public XMLBuilder endElement(String prefix, String name, boolean isEndTagClosed)
    • closeStartElement

      public XMLBuilder closeStartElement()
    • selfCloseElement

      public XMLBuilder selfCloseElement()
    • addSingleAttribute

      public XMLBuilder addSingleAttribute(DOMAttr attr)
    • addSingleAttribute

      public XMLBuilder addSingleAttribute(DOMAttr attr, boolean surroundWithQuotes, boolean prependSpace)
    • addSingleAttribute

      public XMLBuilder addSingleAttribute(String name, String value, boolean surroundWithQuotes)
    • addPrologAttribute

      public XMLBuilder addPrologAttribute(DOMAttr attr)
      Add prolog attribute It will not perform any linefeeds and only basic indentation.
      Parameters:
      attr - attribute
      Returns:
      this XML Builder
    • addAttribute

      public XMLBuilder addAttribute(String name, String value, int level, boolean surroundWithQuotes)
      Used when you are knowingly adding multiple attributes. Does linefeeds and indentation.
      Parameters:
      name -
      value -
      level -
      Returns:
    • addAttribute

      public XMLBuilder addAttribute(DOMAttr attr, int level)
    • append

      public void append(String str)
    • append

      public void append(char c)
    • linefeed

      public XMLBuilder linefeed()
    • addContent

      public XMLBuilder addContent(String text)
      Returns this XMLBuilder with text added
      Parameters:
      text - the text to add
      Returns:
      this XMLBuilder with text added
    • addContent

      public XMLBuilder addContent(String text, boolean isWhitespaceContent, boolean hasSiblings, String delimiter)
      Returns this XMLBuilder with text added depending on isWhitespaceContent, hasSiblings and delimiter
      Parameters:
      text - the proposed text to add
      isWhitespaceContent - whether or not the text contains only whitespace content
      hasSiblings - whether or not the corresponding text node has siblings
      delimiter - line delimiter
      Returns:
      this XMLBuilder with text added depending on isWhitespaceContent, hasSiblings and delimiter
    • indent

      public XMLBuilder indent(int level)
    • startPrologOrPI

      public XMLBuilder startPrologOrPI(String tagName)
    • addContentPI

      public XMLBuilder addContentPI(String content)
    • endPrologOrPI

      public XMLBuilder endPrologOrPI()
    • toString

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

      public void trimFinalNewlines()
      Trims the trailing newlines for the current XML StringBuilder
    • startCDATA

      public XMLBuilder startCDATA()
    • addContentCDATA

      public XMLBuilder addContentCDATA(String content)
    • endCDATA

      public XMLBuilder endCDATA()
    • startComment

      public XMLBuilder startComment(DOMComment comment)
    • addContentComment

      public XMLBuilder addContentComment(String content)
    • addDeclTagStart

      public XMLBuilder addDeclTagStart(DTDDeclNode tag)
    • addDeclTagStart

      public XMLBuilder addDeclTagStart(String declTagName)
    • startDoctype

      public XMLBuilder startDoctype()
    • startDTDElementDecl

      public XMLBuilder startDTDElementDecl()
    • startDTDAttlistDecl

      public XMLBuilder startDTDAttlistDecl()
    • addParameter

      public XMLBuilder addParameter(String parameter)
    • addUnindentedParameter

      public XMLBuilder addUnindentedParameter(String parameter)
    • startDoctypeInternalSubset

      public XMLBuilder startDoctypeInternalSubset()
    • startUnindentedDoctypeInternalSubset

      public XMLBuilder startUnindentedDoctypeInternalSubset()
    • endDoctypeInternalSubset

      public XMLBuilder endDoctypeInternalSubset()
    • endComment

      public XMLBuilder endComment()
    • endDoctype

      public XMLBuilder endDoctype()
    • isLastLineEmptyOrWhitespace

      public boolean isLastLineEmptyOrWhitespace()
    • length

      public int length()
    • charAt

      public char charAt(int index)
    • getSharedSettings

      public SharedSettings getSharedSettings()