public class XMLGenerator extends Object
Constructor and Description |
---|
XMLGenerator(SharedSettings sharedSettings,
boolean autoCloseTags,
String whitespacesIndent,
String lineDelimiter,
boolean canSupportSnippets,
int maxLevel,
DOMNode node) |
XMLGenerator(SharedSettings sharedSettings,
String whitespacesIndent,
String lineDelimiter,
boolean canSupportSnippets,
int maxLevel)
XML generator constructor.
|
Modifier and Type | Method and Description |
---|---|
static org.eclipse.lsp4j.MarkupContent |
createMarkupContent(CMAttributeDeclaration cmAttribute,
CMElementDeclaration ownerElement,
ISharedSettingsRequest request)
Returns a markup content for attribute name documentation and null otherwise.
|
static org.eclipse.lsp4j.MarkupContent |
createMarkupContent(CMAttributeDeclaration cmAttribute,
String attributeValue,
CMElementDeclaration ownerElement,
ISharedSettingsRequest support)
Returns a markup content for attribute value documentation and null
otherwise.
|
static org.eclipse.lsp4j.MarkupContent |
createMarkupContent(CMElementDeclaration cmElement,
ISharedSettingsRequest support)
Returns a markup content for element documentation and null otherwise.
|
static org.eclipse.lsp4j.MarkupContent |
createMarkupContent(CMElementDeclaration cmElement,
String textContent,
ISharedSettingsRequest support)
Returns a markup content for element text documentation and null otherwise.
|
String |
generate(CMElementDeclaration elementDeclaration,
String prefix,
boolean generateEndTag)
Returns the XML generated from the given element declaration.
|
String |
generate(CMElementDeclaration elementDeclaration,
String prefix,
boolean generateEndTag,
boolean generateOnlyChildren,
Collection<String> existingElementNames,
boolean generateOnlyRequired)
Returns the XML generated from the given element declaration given option to
generate only children and only required elements.
|
String |
generate(Collection<CMAttributeDeclaration> attributes,
String tagName) |
static String |
generateAttributeValue(String defaultValue,
Collection<String> enumerationValues,
boolean canSupportSnippets,
int snippetIndex,
boolean withQuote,
SharedSettings sharedSettings)
Creates the string value for a CompletionItem TextEdit
Can create an enumerated TextEdit if given a collection of values.
|
static String |
generateDocumentation(String documentation,
String schemaURI,
boolean html)
Returns a properly formatted documentation string with source.
|
String |
getLineDelimiter()
Returns the line delimiter.
|
String |
getWhitespacesIndent()
Returns the whitespaces indentation.
|
public XMLGenerator(SharedSettings sharedSettings, String whitespacesIndent, String lineDelimiter, boolean canSupportSnippets, int maxLevel)
sharedSettings
- the settings containing formatting options (uses
spaces or tabs for indentation, etc) and
preferenceswhitespacesIndent
- the whitespaces to use to indent XML children
elements.lineDelimiter
- the line delimiter to use when several XML elements
must be generated.canSupportSnippets
- true if snippets can be supported and false
otherwise.public XMLGenerator(SharedSettings sharedSettings, boolean autoCloseTags, String whitespacesIndent, String lineDelimiter, boolean canSupportSnippets, int maxLevel, DOMNode node)
public String getLineDelimiter()
public String getWhitespacesIndent()
public String generate(CMElementDeclaration elementDeclaration, String prefix, boolean generateEndTag)
elementDeclaration
- prefix
- public String generate(CMElementDeclaration elementDeclaration, String prefix, boolean generateEndTag, boolean generateOnlyChildren, Collection<String> existingElementNames, boolean generateOnlyRequired)
elementDeclaration
- prefix
- generateEndTag
- generateOnlyChildren
- true if only is children of the given element is
to be generatedexistingElementNames
- a collection of strings of element names that
already exist in the XMLgenerateOnlyRequired
- true if only the required elements is to be
generatedpublic String generate(Collection<CMAttributeDeclaration> attributes, String tagName)
public static String generateAttributeValue(String defaultValue, Collection<String> enumerationValues, boolean canSupportSnippets, int snippetIndex, boolean withQuote, SharedSettings sharedSettings)
public static String generateDocumentation(String documentation, String schemaURI, boolean html)
documentation
- schemaURI
- public static org.eclipse.lsp4j.MarkupContent createMarkupContent(CMElementDeclaration cmElement, ISharedSettingsRequest support)
cmElement
- support
- public static org.eclipse.lsp4j.MarkupContent createMarkupContent(CMAttributeDeclaration cmAttribute, CMElementDeclaration ownerElement, ISharedSettingsRequest request)
cmAttribute
- the attribute declarationownerElement
- the owner element declarationrequest
- the requestpublic static org.eclipse.lsp4j.MarkupContent createMarkupContent(CMAttributeDeclaration cmAttribute, String attributeValue, CMElementDeclaration ownerElement, ISharedSettingsRequest support)
cmAttribute
- attributeValue
- ownerElement
- support
- public static org.eclipse.lsp4j.MarkupContent createMarkupContent(CMElementDeclaration cmElement, String textContent, ISharedSettingsRequest support)
cmElement
- element declaration.textContent
- the text content.support
- markup kind support.Copyright © 2022. All rights reserved.