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) |
Modifier and Type | Method and Description |
---|---|
org.eclipse.lsp4j.Diagnostic |
addDiagnostic(org.eclipse.lsp4j.Range adjustedRange,
String message,
org.eclipse.lsp4j.DiagnosticSeverity severity,
String key) |
protected org.eclipse.lsp4j.Range |
createDefaultRange(org.apache.xerces.xni.XMLLocator location,
DOMDocument document) |
protected DOMDocument |
getDOMDocument()
Returns the DOM document which is validating.
|
static boolean |
initializeReporter(org.apache.xerces.impl.xs.XMLSchemaLoader schemaLoader,
org.apache.xerces.impl.XMLErrorReporter reporter) |
static boolean |
initializeReporter(org.apache.xerces.impl.xs.XMLSchemaValidator schemaValidator,
org.apache.xerces.impl.XMLErrorReporter reporter) |
protected boolean |
isIgnoreFatalError(String key) |
String |
reportError(org.apache.xerces.xni.XMLLocator location,
String domain,
String key,
Object[] arguments,
short severity,
Exception exception) |
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)
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 boolean isIgnoreFatalError(String key)
public org.eclipse.lsp4j.Diagnostic addDiagnostic(org.eclipse.lsp4j.Range adjustedRange, String message, org.eclipse.lsp4j.DiagnosticSeverity severity, String key)
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)
public static boolean initializeReporter(org.apache.xerces.impl.xs.XMLSchemaLoader schemaLoader, org.apache.xerces.impl.XMLErrorReporter reporter)
Copyright © 2021. All rights reserved.