Package org.eclipse.lemminx.utils
Class XMLBuilder
java.lang.Object
org.eclipse.lemminx.utils.XMLBuilder
XML content builder utilities.
-
Constructor Summary
ConstructorsConstructorDescriptionXMLBuilder(SharedSettings sharedSettings, String whitespacesIndent, String lineDelimiter) XMLBuilder(SharedSettings sharedSettings, String whitespacesIndent, String lineDelimiter, Collection<IFormatterParticipant> formatterParticipants) -
Method Summary
Modifier and TypeMethodDescriptionaddAttribute(String name, String value, int level, boolean surroundWithQuotes) Used when you are knowingly adding multiple attributes.addAttribute(DOMAttr attr, int level) addContent(String text) Returns this XMLBuilder withtextaddedaddContent(String text, boolean isWhitespaceContent, boolean hasSiblings, String delimiter) Returns this XMLBuilder withtextadded depending onisWhitespaceContent,hasSiblingsanddelimiteraddContentCDATA(String content) addContentComment(String content) addContentPI(String content) addDeclTagStart(String declTagName) addParameter(String parameter) addPrologAttribute(DOMAttr attr) Add prolog attribute It will not perform any linefeeds and only basic indentation.addSingleAttribute(String name, String value, boolean surroundWithQuotes) addSingleAttribute(DOMAttr attr) addSingleAttribute(DOMAttr attr, boolean surroundWithQuotes, boolean prependSpace) addUnindentedParameter(String parameter) voidappend(char c) voidcharcharAt(int index) endCDATA()endElement(String name) endElement(String name, boolean isEndTagClosed) endElement(String prefix, String name) endElement(String prefix, String name, boolean isEndTagClosed) indent(int level) booleanintlength()linefeed()startComment(DOMComment comment) startElement(String name, boolean close) startElement(String prefix, String name, boolean close) startPrologOrPI(String tagName) toString()voidTrims the trailing newlines for the current XML StringBuilder
-
Constructor Details
-
Method Details
-
appendSpace
-
startElement
-
startElement
-
endElement
-
endElement
-
endElement
-
endElement
-
closeStartElement
-
selfCloseElement
-
addSingleAttribute
-
addSingleAttribute
public XMLBuilder addSingleAttribute(DOMAttr attr, boolean surroundWithQuotes, boolean prependSpace) -
addSingleAttribute
-
addPrologAttribute
Add prolog attribute It will not perform any linefeeds and only basic indentation.- Parameters:
attr- attribute- Returns:
- this XML Builder
-
addAttribute
Used when you are knowingly adding multiple attributes. Does linefeeds and indentation.- Parameters:
name-value-level-- Returns:
-
addAttribute
-
append
-
append
public void append(char c) -
linefeed
-
addContent
Returns this XMLBuilder withtextadded- Parameters:
text- the text to add- Returns:
- this XMLBuilder with
textadded
-
addContent
public XMLBuilder addContent(String text, boolean isWhitespaceContent, boolean hasSiblings, String delimiter) Returns this XMLBuilder withtextadded depending onisWhitespaceContent,hasSiblingsanddelimiter- Parameters:
text- the proposed text to addisWhitespaceContent- whether or not the text contains only whitespace contenthasSiblings- whether or not the corresponding text node has siblingsdelimiter- line delimiter- Returns:
- this XMLBuilder with
textadded depending onisWhitespaceContent,hasSiblingsanddelimiter
-
indent
-
startPrologOrPI
-
addContentPI
-
endPrologOrPI
-
toString
-
trimFinalNewlines
public void trimFinalNewlines()Trims the trailing newlines for the current XML StringBuilder -
startCDATA
-
addContentCDATA
-
endCDATA
-
startComment
-
addContentComment
-
addDeclTagStart
-
addDeclTagStart
-
startDoctype
-
startDTDElementDecl
-
startDTDAttlistDecl
-
addParameter
-
addUnindentedParameter
-
startDoctypeInternalSubset
-
startUnindentedDoctypeInternalSubset
-
endDoctypeInternalSubset
-
endComment
-
endDoctype
-
isLastLineEmptyOrWhitespace
public boolean isLastLineEmptyOrWhitespace() -
length
public int length() -
charAt
public char charAt(int index)
-