Package org.eclipse.lemminx.utils

## Class XMLBuilder

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

    public class XMLBuilder
    extends Object

XML content builder utilities.

### Constructor Summary

Constructors
`XMLBuilder​(SharedSettings sharedSettings, String whitespacesIndent, String lineDelimiter)`
`XMLBuilder​(SharedSettings sharedSettings, String whitespacesIndent, String lineDelimiter, Collection<IFormatterParticipant> formatterParticipants)`

### Method Summary

All Methods Instance Methods Concrete Methods
`XMLBuilder` `addAttribute​(String name, String value, int level, boolean surroundWithQuotes)` Used when you are knowingly adding multiple attributes.
`XMLBuilder` `addAttribute​(DOMAttr attr, int level)`
`XMLBuilder` `addContent​(String text)` Returns this XMLBuilder with `text` added
`XMLBuilder` `addContent​(String text, boolean isWhitespaceContent, boolean hasSiblings, String delimiter)` Returns this XMLBuilder with `text` added depending on `isWhitespaceContent`, `hasSiblings` and `delimiter`
`XMLBuilder` `addContentCDATA​(String content)`
`XMLBuilder` `addContentComment​(String content)`
`XMLBuilder` `addContentPI​(String content)`
`XMLBuilder` `addDeclTagStart​(String declTagName)`
`XMLBuilder` `addDeclTagStart​(DTDDeclNode tag)`
`XMLBuilder` `addParameter​(String parameter)`
`XMLBuilder` `addPrologAttribute​(DOMAttr attr)` Add prolog attribute It will not perform any linefeeds and only basic indentation.
`XMLBuilder` `addSingleAttribute​(String name, String value, boolean surroundWithQuotes)`
`XMLBuilder` `addSingleAttribute​(DOMAttr attr)`
`XMLBuilder` `addSingleAttribute​(DOMAttr attr, boolean surroundWithQuotes, boolean prependSpace)`
`XMLBuilder` `addUnindentedParameter​(String parameter)`
`void` `append​(char c)`
`void` `append​(String str)`
`XMLBuilder` `appendSpace()`
`char` `charAt​(int index)`
`XMLBuilder` `closeStartElement()`
`XMLBuilder` `endCDATA()`
`XMLBuilder` `endComment()`
`XMLBuilder` `endDoctype()`
`XMLBuilder` `endDoctypeInternalSubset()`
`XMLBuilder` `endElement​(String name)`
`XMLBuilder` `endElement​(String name, boolean isEndTagClosed)`
`XMLBuilder` `endElement​(String prefix, String name)`
`XMLBuilder` `endElement​(String prefix, String name, boolean isEndTagClosed)`
`XMLBuilder` `endPrologOrPI()`
`SharedSettings` `getSharedSettings()`
`XMLBuilder` `indent​(int level)`
`boolean` `isLastLineEmptyOrWhitespace()`
`int` `length()`
`XMLBuilder` `linefeed()`
`XMLBuilder` `selfCloseElement()`
`XMLBuilder` `startCDATA()`
`XMLBuilder` `startComment​(DOMComment comment)`
`XMLBuilder` `startDoctype()`
`XMLBuilder` `startDoctypeInternalSubset()`
`XMLBuilder` `startDTDAttlistDecl()`
`XMLBuilder` `startDTDElementDecl()`
`XMLBuilder` `startElement​(String name, boolean close)`
`XMLBuilder` `startElement​(String prefix, String name, boolean close)`
`XMLBuilder` `startPrologOrPI​(String tagName)`
`XMLBuilder` `startUnindentedDoctypeInternalSubset()`
`String` `toString()`
`void` `trimFinalNewlines()` Trims the trailing newlines for the current XML StringBuilder

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### XMLBuilder

    public XMLBuilder​(SharedSettings sharedSettings,
                      String whitespacesIndent,
                      String lineDelimiter)

#### XMLBuilder

    public XMLBuilder​(SharedSettings sharedSettings,
                      String whitespacesIndent,
                      String lineDelimiter,
                      Collection<IFormatterParticipant> formatterParticipants)

### Method Detail

#### 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()