Class GenerateGrammarFromXMLCommand

java.lang.Object
org.eclipse.lemminx.services.extensions.commands.AbstractDOMDocumentCommandHandler
org.eclipse.lemminx.extensions.contentmodel.commands.GenerateGrammarFromXMLCommand
All Implemented Interfaces:
IXMLCommandService.IDelegateCommandHandler

public class GenerateGrammarFromXMLCommand extends AbstractDOMDocumentCommandHandler
XML Command "xml.grammar.generateFromXml" to generate a grammar file (XSD, DTD, RelaxNG) from a given XML document and optionally bind it.

The command parameters ExecuteCommandParams must be filled with:

  • arg 0: document URI (TextDocumentIdentifier) - the XML document.
  • arg 1: grammar type (String) - "xsd", "dtd", or "rng".
  • arg 2: grammar file URI (String) - the target grammar file URI.
  • arg 3: binding type (String, optional) - "xsi:noNamespaceSchemaLocation", "xsi:schemaLocation", "xml-model", "DOCTYPE", or null for file association (client handles binding).

Returns a GenerateGrammarFromXMLCommand.GenerateGrammarResult with the generated grammar content and an optional binding text edit.

  • Field Details

  • Constructor Details

  • Method Details

    • executeCommand

      protected Object executeCommand(DOMDocument document, org.eclipse.lsp4j.ExecuteCommandParams params, SharedSettings sharedSettings, org.eclipse.lsp4j.jsonrpc.CancelChecker cancelChecker) throws Exception
      Description copied from class: AbstractDOMDocumentCommandHandler
      Executes a command
      Specified by:
      executeCommand in class AbstractDOMDocumentCommandHandler
      Parameters:
      document - the DOM document retrieve by the TextDocumentIdentifier argument.
      params - command execution parameters
      sharedSettings - the shared settings
      cancelChecker - check if cancel has been requested
      Returns:
      the result of the command
      Throws:
      Exception - the unhandled exception will be wrapped in org.eclipse.lsp4j.jsonrpc.ResponseErrorException and be wired back to the JSON-RPC protocol caller