Project

Profile

Help

Support #4919

closed

Line numbering not applied to files supplied on command line

Added by Michael Kay about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2021-02-25
Due date:
% Done:

0%

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

Description

When a file is supplied as a command line parameter using the syntax +param=filename.xml, and when the -l option is present on the command line, the supplied file does not have line numbers available.

Actions #1

Updated by Michael Kay about 3 years ago

Solution: in CommandLineOptions.applyFileParameters() add code as follows:

                List<XdmNode> nodeList = new ArrayList<>(sourceList.size());
                DocumentBuilder builder = processor.newDocumentBuilder();
          >      if (!"off".equals(getOptionValue("l"))) {
          >          builder.setLineNumbering(true);
          >      }
                for (Source s : sourceList) {
                    nodeList.add(builder.build(s));
                }

But perhaps there are other options we should be setting here as well, e.g. DTD validation.

Actions #2

Updated by Michael Kay about 3 years ago

I'm not sure why I proposed the logic if (!"off".equals(getOptionValue("l"))) which switches line numbering on in the absence of the -l option.

Actually, after writing some tests (commands/QueryTests), I'm not sure why I thought any change was needed. The tests seem to pass with the code "as is". The -l option on the command line affects the default parse options held in the Configuration; these in turn are passed to the DocumentBuilder used to build the parameter documents.

Actions #3

Updated by Michael Kay about 3 years ago

  • Tracker changed from Bug to Support
  • Status changed from New to Closed

Confirmed that this bug appears to have never existed.

In working on it, however, I have added a number of command line tests for both Query and Transform, and have made significant improvements to the mechanisms for testing command line invocations and their results in these test sets.

Please register to edit this issue

Also available in: Atom PDF