Class XMLGenerationSettings

java.lang.Object
org.eclipse.lemminx.extensions.contentmodel.generator.XMLGenerationSettings

public class XMLGenerationSettings extends Object
Settings for XML document generation from grammar.

These settings control how XMLDocumentGenerator produces XML content from a grammar (XSD, DTD, RelaxNG, RNC). They can be configured globally via client settings or per-grammar via generation profiles.

  • Field Details

    • DEFAULT_MAX_DEPTH

      public static final int DEFAULT_MAX_DEPTH
      See Also:
    • DEFAULT_OPTIONAL_ELEMENTS

      public static final boolean DEFAULT_OPTIONAL_ELEMENTS
      See Also:
    • DEFAULT_TYPE_DEFAULTS

      public static final boolean DEFAULT_TYPE_DEFAULTS
      See Also:
  • Constructor Details

    • XMLGenerationSettings

      public XMLGenerationSettings()
  • Method Details

    • getMaxDepth

      public int getMaxDepth()
      Returns the maximum depth for nested element generation.
      Returns:
      the maximum depth (default 10).
    • setMaxDepth

      public void setMaxDepth(int maxDepth)
      Sets the maximum depth for nested element generation.
      Parameters:
      maxDepth - the maximum depth.
    • isOptionalElements

      public boolean isOptionalElements()
      Returns whether optional elements should be generated.
      Returns:
      true if optional elements should be generated (default true).
    • setOptionalElements

      public void setOptionalElements(boolean optionalElements)
      Sets whether optional elements should be generated.
      Parameters:
      optionalElements - true to generate optional elements.
    • isTypeDefaults

      public boolean isTypeDefaults()
      Returns whether type-aware default values should be generated (e.g., "0" for xs:integer, "2026-01-01" for xs:date).
      Returns:
      true if type-aware defaults should be generated (default true).
    • setTypeDefaults

      public void setTypeDefaults(boolean typeDefaults)
      Sets whether type-aware default values should be generated.
      Parameters:
      typeDefaults - true to generate type-aware defaults.
    • getProfiles

      Returns the generation profiles list.
      Returns:
      the profiles list, or null if none.
    • setProfiles

      public void setProfiles(List<XMLGenerationSettings.GenerationProfile> profiles)
      Sets the generation profiles list.
      Parameters:
      profiles - the profiles list.
    • resolve

      public XMLGenerationSettings resolve(String grammarURI)
      Returns a resolved copy of these settings by applying the first matching profile for the given grammar URI. If no profile matches, returns a copy with the global settings.

      Profile matching uses

      invalid reference
      PathPatternMatcher
      for file:// URIs (Java NIO glob) and a simple textual glob match for http:// / https:// URIs.

      Parameters:
      grammarURI - the grammar file URI to match against profile patterns.
      Returns:
      the resolved settings.