Class AbstractLSPErrorReporter
java.lang.Object
org.apache.xerces.impl.XMLErrorReporter
org.eclipse.lemminx.extensions.xerces.AbstractLSPErrorReporter
- All Implemented Interfaces:
org.apache.xerces.xni.parser.XMLComponent
- Direct Known Subclasses:
AbstractReferencedGrammarLSPErrorReporter
public abstract class AbstractLSPErrorReporter
extends org.apache.xerces.impl.XMLErrorReporter
The SAX
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.-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionAbstractLSPErrorReporter(String source, DOMDocument xmlDocument, List<org.eclipse.lsp4j.Diagnostic> diagnostics, boolean hasRelatedInfo) -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.lsp4j.DiagnosticaddDiagnostic(org.eclipse.lsp4j.Range adjustedRange, String message, org.eclipse.lsp4j.DiagnosticSeverity severity, String code, List<org.eclipse.lsp4j.DiagnosticRelatedInformation> relatedInformation) protected org.eclipse.lsp4j.RangecreateDefaultRange(org.apache.xerces.xni.XMLLocator location, DOMDocument document) protected Stringprotected DOMDocumentReturns the DOM document which is validating.protected StringgetMessage(String domain, String key, Object[] arguments, Exception exception) protected org.eclipse.lsp4j.DiagnosticSeveritygetSeverity(String domain, String key, Object[] arguments, short severity, Exception exception) static booleaninitializeReporter(org.apache.xerces.impl.xs.XMLSchemaLoader schemaLoader, org.apache.xerces.impl.XMLErrorReporter reporter, org.apache.xerces.impl.XMLEntityManager entityManager) static booleaninitializeReporter(org.apache.xerces.impl.xs.XMLSchemaValidator schemaValidator, org.apache.xerces.impl.XMLErrorReporter reporter, org.apache.xerces.impl.XMLEntityManager entityManager) protected booleanisIgnoreFatalError(String key) reportError(org.apache.xerces.xni.XMLLocator location, String domain, String key, Object[] arguments, short severity, Exception exception) voidsetCurrentError(Exception currentError) protected abstract org.eclipse.lsp4j.RangetoLSPRange(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_RANGEif diagnostic must not be created and null otherwise.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
-
Field Details
-
NO_RANGE
protected static final org.eclipse.lsp4j.Range NO_RANGE
-
-
Constructor Details
-
AbstractLSPErrorReporter
public AbstractLSPErrorReporter(String source, DOMDocument xmlDocument, List<org.eclipse.lsp4j.Diagnostic> diagnostics, boolean hasRelatedInfo)
-
-
Method Details
-
reportError
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 - Overrides:
reportErrorin classorg.apache.xerces.impl.XMLErrorReporter- Throws:
org.apache.xerces.xni.XNIException
-
getSeverity
-
getMessage
-
getCode
-
isIgnoreFatalError
-
addDiagnostic
-
createDefaultRange
protected org.eclipse.lsp4j.Range createDefaultRange(org.apache.xerces.xni.XMLLocator location, DOMDocument document) -
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) Returns the range of the given error information, or {NO_RANGEif diagnostic must not be created and null otherwise.- 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- true if Xerces report the error as fatal and false otherwise.document- the DOM document.- Returns:
-
getDOMDocument
Returns the DOM document which is validating.- Returns:
- the DOM document which is validating.
-
initializeReporter
public static boolean initializeReporter(org.apache.xerces.impl.xs.XMLSchemaValidator schemaValidator, org.apache.xerces.impl.XMLErrorReporter reporter, org.apache.xerces.impl.XMLEntityManager entityManager) -
initializeReporter
public static boolean initializeReporter(org.apache.xerces.impl.xs.XMLSchemaLoader schemaLoader, org.apache.xerces.impl.XMLErrorReporter reporter, org.apache.xerces.impl.XMLEntityManager entityManager) -
setCurrentError
-