public abstract class AbstractLSPErrorReporter
extends org.apache.xerces.impl.XMLErrorReporter
ErrorHandler
gives just information of the offset where there
is an error. To improve highlight XML error, this class extends the Xerces
XML reporter to catch location, key, arguments which is helpful to adjust the
LSP range.Modifier and Type | Field and Description |
---|---|
protected static org.eclipse.lsp4j.Range |
NO_RANGE |
Constructor and Description |
---|
AbstractLSPErrorReporter(String source,
DOMDocument xmlDocument,
List<org.eclipse.lsp4j.Diagnostic> diagnostics,
boolean hasRelatedInfo) |
Modifier and Type | Method and Description |
---|---|
org.eclipse.lsp4j.Diagnostic |
addDiagnostic(org.eclipse.lsp4j.Range adjustedRange,
String message,
org.eclipse.lsp4j.DiagnosticSeverity severity,
String code,
List<org.eclipse.lsp4j.DiagnosticRelatedInformation> relatedInformation) |
protected org.eclipse.lsp4j.Range |
createDefaultRange(org.apache.xerces.xni.XMLLocator location,
DOMDocument document) |
protected String |
getCode(String domain,
String key,
Object[] arguments,
Exception exception) |
protected DOMDocument |
getDOMDocument()
Returns the DOM document which is validating.
|
protected String |
getMessage(String domain,
String key,
Object[] arguments,
Exception exception) |
protected org.eclipse.lsp4j.DiagnosticSeverity |
getSeverity(String domain,
String key,
Object[] arguments,
short severity,
Exception exception) |
static boolean |
initializeReporter(org.apache.xerces.impl.xs.XMLSchemaLoader schemaLoader,
org.apache.xerces.impl.XMLErrorReporter reporter,
org.apache.xerces.impl.XMLEntityManager entityManager) |
static boolean |
initializeReporter(org.apache.xerces.impl.xs.XMLSchemaValidator schemaValidator,
org.apache.xerces.impl.XMLErrorReporter reporter,
org.apache.xerces.impl.XMLEntityManager entityManager) |
protected boolean |
isIgnoreFatalError(String key) |
String |
reportError(org.apache.xerces.xni.XMLLocator location,
String domain,
String key,
Object[] arguments,
short severity,
Exception exception) |
void |
setCurrentError(Exception currentError) |
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)
Returns the range of the given error information, or {
NO_RANGE if
diagnostic must not be created and null otherwise. |
getErrorHandler, getFeature, getFeatureDefault, getLocale, getMessageFormatter, getPropertyDefault, getRecognizedFeatures, getRecognizedProperties, getSAXErrorHandler, putMessageFormatter, removeMessageFormatter, reportError, reportError, reportError, reset, setDocumentLocator, setFeature, setLocale, setProperty
public AbstractLSPErrorReporter(String source, DOMDocument xmlDocument, List<org.eclipse.lsp4j.Diagnostic> diagnostics, boolean hasRelatedInfo)
public String reportError(org.apache.xerces.xni.XMLLocator location, String domain, String key, Object[] arguments, short severity, Exception exception) throws org.apache.xerces.xni.XNIException
reportError
in class org.apache.xerces.impl.XMLErrorReporter
org.apache.xerces.xni.XNIException
protected org.eclipse.lsp4j.DiagnosticSeverity getSeverity(String domain, String key, Object[] arguments, short severity, Exception exception)
protected String getMessage(String domain, String key, Object[] arguments, Exception exception)
protected String getCode(String domain, String key, Object[] arguments, Exception exception)
protected boolean isIgnoreFatalError(String key)
public org.eclipse.lsp4j.Diagnostic addDiagnostic(org.eclipse.lsp4j.Range adjustedRange, String message, org.eclipse.lsp4j.DiagnosticSeverity severity, String code, List<org.eclipse.lsp4j.DiagnosticRelatedInformation> relatedInformation)
protected org.eclipse.lsp4j.Range createDefaultRange(org.apache.xerces.xni.XMLLocator location, DOMDocument document)
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)
NO_RANGE
if
diagnostic must not be created and null otherwise.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
- true if Xerces report the error as fatal and false
otherwise.document
- the DOM document.protected DOMDocument getDOMDocument()
public static boolean initializeReporter(org.apache.xerces.impl.xs.XMLSchemaValidator schemaValidator, org.apache.xerces.impl.XMLErrorReporter reporter, org.apache.xerces.impl.XMLEntityManager entityManager)
public static boolean initializeReporter(org.apache.xerces.impl.xs.XMLSchemaLoader schemaLoader, org.apache.xerces.impl.XMLErrorReporter reporter, org.apache.xerces.impl.XMLEntityManager entityManager)
public void setCurrentError(Exception currentError)
Copyright © 2022. All rights reserved.