Support #4919
closed
Line numbering not applied to files supplied on command line
Fixed in Maintenance Release:
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.
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.
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.
- 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