Project

Profile

Help

Support #5272

closed

XQuery ErrorReporter needs to be set in 3 places

Added by Radu Coravu 5 months ago. Updated 30 days ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2022-02-03
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Not sure if this is still the case with Saxon 11.1. In this code:

      Processor proc = new Processor(configuration);      
      proc.getUnderlyingConfiguration().setErrorReporterFactory(config -> {return new ErrorReporterToListener(errorListener);});
      proc.setConfigurationProperty(Feature.NAME_POOL, proc.getUnderlyingConfiguration().getNamePool());
      proc.setConfigurationProperty(Feature.SOURCE_PARSER_CLASS, CatalogEnabledXMLReader.class.getName());
      proc.setConfigurationProperty(Feature.LINE_NUMBERING, Boolean.TRUE);
      proc.setConfigurationProperty(Feature.TREE_MODEL, Builder.LINKED_TREE);

      // XQuery compiler
      XQueryCompiler comp = proc.newXQueryCompiler();
      comp.setErrorReporter(new ErrorReporterToListener(errorListener));
      comp.setBaseURI(new URI(querySystemID));
      XQueryExecutable xPathExecutable = comp.compile(parameter.getValue());
      XQueryEvaluator pathSelector = xPathExecutable.load();
      pathSelector.setErrorListener(errorListener);

in order to avoid various errors being reported in the console I needed to set the error listener on proc.getUnderlyingConfiguration(), on the XQueryCompiler and on the XQueryEvaluator, otherwise in some stages the errors were dumped to the standard error listener.

Actions #1

Updated by Michael Kay 30 days ago

  • Category set to Diagnostics
  • Status changed from New to Closed
  • Assignee set to Michael Kay

Sorry we've allowed this one to fester. I've looked at it a few times to think about whether there's any way we can make progress on it.

XQuery static errors should be reported to the ErrorReporter associated with the XQueryCompiler. Dynamic errors should be reported to the ErrorReporter associated with the XQueryEvaluator. Generally, errors shouldn't find their way to the Configuration's ErrorHandler unless they're not linked to a specific query. I could imagine this happening, for example, if the error is in document building or validation. If you find any such errors, please let us know and we'll see what we can do. In the meantime, I'm afraid there's no particular plan I can think of for identifying such errors.

I'm going to close this tracker now, but if you have any further information that will help us to make progress, please feel free to re-open it.

Please register to edit this issue

Also available in: Atom PDF