Project

Profile

Help

Support #5272

closed

XQuery ErrorReporter needs to be set in 3 places

Added by Radu Coravu about 2 years ago. Updated almost 2 years 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.

Please register to edit this issue

Also available in: Atom PDF