Package org.eclipse.lemminx.extensions.xerces

## Class AbstractReferencedGrammarLSPErrorReporter

- java.lang.Object
- - org.apache.xerces.impl.XMLErrorReporter
  - - org.eclipse.lemminx.extensions.xerces.AbstractLSPErrorReporter
    - - org.eclipse.lemminx.extensions.xerces.AbstractReferencedGrammarLSPErrorReporter

All Implemented Interfaces:
  `org.apache.xerces.xni.parser.XMLComponent`

Direct Known Subclasses:
  `LSPErrorReporterForXML`, `LSPErrorReporterForXSD`

    public abstract class AbstractReferencedGrammarLSPErrorReporter
    extends AbstractLSPErrorReporter

Abstract class reporter with referenced grammar.

Author:
  Angelo ZERR

### Field Summary

Fields
`protected ContentModelManager` `contentModelManager`

### Fields inherited from class org.eclipse.lemminx.extensions.xerces.AbstractLSPErrorReporter

`NO_RANGE`

### Fields inherited from class org.apache.xerces.impl.XMLErrorReporter

`CONTINUE_AFTER_FATAL_ERROR, ERROR_HANDLER, fContinueAfterFatalError, fDefaultErrorHandler, fErrorHandler, fLocale, fLocator, fMessageFormatters, SEVERITY_ERROR, SEVERITY_FATAL_ERROR, SEVERITY_WARNING`

### Constructor Summary

Constructors
`AbstractReferencedGrammarLSPErrorReporter​(String source, DOMDocument xmlDocument, List<org.eclipse.lsp4j.Diagnostic> diagnostics, ContentModelManager contentModelManager, boolean hasRelatedInformation, Map<String,​ReferencedGrammarDiagnosticsInfo> referencedGrammarDiagnosticsInfoCache)`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`void` `endReport()`

`protected void`

`fillReferencedGrammarDiagnostic​(org.apache.xerces.xni.XMLLocator location, String key, Object[] arguments, String message, org.eclipse.lsp4j.DiagnosticSeverity diagnosticSeverity, boolean fatalError, URIResolverExtensionManager resolverExtensionManager, XMLSyntaxErrorCode syntaxCode, XMLSchemaErrorCode schemaErrorCode, DTDErrorCode dtdCode, XSDErrorCode xsdCode, RelaxNGErrorCode rngCode, XIncludeErrorCode xIncludeCode, String grammarURI)`

Create a diagnostic root where XSD, DTD which have the error if needed and attach the error as related information if LSP client support it.

`protected String` `getCode​(String domain, String key, Object[] arguments, Exception exception)`
`protected String` `getMessage​(String domain, String key, Object[] arguments, Exception exception)`
`protected abstract org.eclipse.lsp4j.Range` `getReferencedGrammarRange​(String grammarURI)`
`protected org.eclipse.lsp4j.DiagnosticSeverity` `getSeverity​(String domain, String key, Object[] arguments, short severity, Exception exception)`
`protected org.eclipse.lsp4j.Range` `toLSPRange​(org.apache.xerces.xni.XMLLocator location, String key, Object[] arguments, String message, org.eclipse.lsp4j.DiagnosticSeverity diagnosticSeverity, boolean fatalError, DOMDocument document)` Create the LSP range from the SAX error.
`protected abstract org.eclipse.lsp4j.Range` `toLSPRange​(org.apache.xerces.xni.XMLLocator location, String key, Object[] arguments, String message, org.eclipse.lsp4j.DiagnosticSeverity diagnosticSeverity, boolean fatalError, DOMDocument document, String documentOrGrammarURI, boolean errorForDocument)`

### Methods inherited from class org.eclipse.lemminx.extensions.xerces.AbstractLSPErrorReporter

`addDiagnostic, createDefaultRange, getDOMDocument, initializeReporter, initializeReporter, isIgnoreFatalError, reportError, setCurrentError`

### Methods inherited from class org.apache.xerces.impl.XMLErrorReporter

`getErrorHandler, getFeature, getFeatureDefault, getLocale, getMessageFormatter, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, getSAXErrorHandler, putMessageFormatter, removeMessageFormatter, reportError, reportError, reportError, reset, setDocumentLocator, setFeature, setLocale, setProperty`

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

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

### Field Detail

#### contentModelManager

    protected final ContentModelManager contentModelManager

### Constructor Detail

#### AbstractReferencedGrammarLSPErrorReporter

    public AbstractReferencedGrammarLSPErrorReporter​(String source,
                                                     DOMDocument xmlDocument,
                                                     List<org.eclipse.lsp4j.Diagnostic> diagnostics,
                                                     ContentModelManager contentModelManager,
                                                     boolean hasRelatedInformation,
                                                     Map<String,​ReferencedGrammarDiagnosticsInfo> referencedGrammarDiagnosticsInfoCache)

### Method Detail

#### toLSPRange

    protected org.eclipse.lsp4j.Range toLSPRange​(org.apache.xerces.xni.XMLLocator location,
                                                 String key,
                                                 Object[] arguments,
                                                 String message,
                                                 org.eclipse.lsp4j.DiagnosticSeverity diagnosticSeverity,
                                                 boolean fatalError,
                                                 DOMDocument document)

Create the LSP range from the SAX error.

Specified by:
  `toLSPRange` in class `AbstractLSPErrorReporter`
Parameters:
  `location` -
  `key` -
  `arguments` -
  `document` -
  `message` - the Xerces error message.
  `diagnosticSeverity` - the the Xerces severity.
  `fatalError` - true if Xerces report the error as fatal and false otherwise.
Returns:
  the LSP range from the SAX error.

#### fillReferencedGrammarDiagnostic

    protected void fillReferencedGrammarDiagnostic​(org.apache.xerces.xni.XMLLocator location,
                                                   String key,
                                                   Object[] arguments,
                                                   String message,
                                                   org.eclipse.lsp4j.DiagnosticSeverity diagnosticSeverity,
                                                   boolean fatalError,
                                                   URIResolverExtensionManager resolverExtensionManager,
                                                   XMLSyntaxErrorCode syntaxCode,
                                                   XMLSchemaErrorCode schemaErrorCode,
                                                   DTDErrorCode dtdCode,
                                                   XSDErrorCode xsdCode,
                                                   RelaxNGErrorCode rngCode,
                                                   XIncludeErrorCode xIncludeCode,
                                                   String grammarURI)

Create a diagnostic root where XSD, DTD which have the error if needed and attach the error as related information if LSP client support it.

Parameters:
  `location` - the Xerces location.
  `key` - the Xerces error key
  `arguments` - the Xerces error arguments
  `message` - the Xerces error message
  `diagnosticSeverity` - the the Xerces severity
  `fatalError` -
  `resolverExtensionManager` - the resolver
  `syntaxCode` - the Syntax error code and null otherwise.
  `dtdCode` - the DTD error code and null otherwise.
  `xsdCode` - the XSD error code and null otherwise.
  `rngCode` - the RelaxNG error code and null otherwise.
  `grammarURI` - the referenced grammar URI.

#### endReport

    public void endReport()

#### getMessage

    protected String getMessage​(String domain,
                                String key,
                                Object[] arguments,
                                Exception exception)

Overrides:
  `getMessage` in class `AbstractLSPErrorReporter`

#### getSeverity

    protected org.eclipse.lsp4j.DiagnosticSeverity getSeverity​(String domain,
                                                               String key,
                                                               Object[] arguments,
                                                               short severity,
                                                               Exception exception)

Overrides:
  `getSeverity` in class `AbstractLSPErrorReporter`

#### getCode

    protected String getCode​(String domain,
                             String key,
                             Object[] arguments,
                             Exception exception)

Overrides:
  `getCode` in class `AbstractLSPErrorReporter`

#### toLSPRange

    protected abstract org.eclipse.lsp4j.Range toLSPRange​(org.apache.xerces.xni.XMLLocator location,
                                                          String key,
                                                          Object[] arguments,
                                                          String message,
                                                          org.eclipse.lsp4j.DiagnosticSeverity diagnosticSeverity,
                                                          boolean fatalError,
                                                          DOMDocument document,
                                                          String documentOrGrammarURI,
                                                          boolean errorForDocument)

#### getReferencedGrammarRange

    protected abstract org.eclipse.lsp4j.Range getReferencedGrammarRange​(String grammarURI)