On 22 Aug 2018, at 3:44 am, Christian Grün christian.gruen@gmail.com wrote:
I didn’t manage to reproduce this behavior. Do you work with the latest version of BaseX?
9.0.2.
If yes, could you possibly download a fresh version (e.g. the zip distribution) and tell us step by step how I can simulate the behavior?
Further clarification/correction to what I reported:
* When I said "empty string", in fact the "problem" arises when standard input is _not_ empty, but includes just a blank line. * When standard input is empty, I get an exception NoSuchElementException. That is probably acceptable: at least, it is better than getting output that has nothing to do with the input data. * When I said "one of my databases", I think that _may_ have been wrong. It may be content from an XML file in the current directory (or, as you'll see below, from some part of the distribution) ... I can't easily tell.
What follows was done on a Mac; "$" is a placeholder for the shell prompt.
Three tests: * The first test shows what I expected to be the behaviour for data read from standard input. * The second test shows when standard input is empty (echo -n ''): an exception. * The third test shows when standard input contains just a blank line (echo ''): it seems to read from the factbook.xml data (from basex/etc/factbook.xml?)
$ mkdir basex-report $ cd basex-report $ wget http://files.basex.org/releases/9.0.2/BaseX902.zip ... output omitted ... $ unzip BaseX902.zip Archive: BaseX902.zip extracting: basex/.basexhome inflating: basex/BaseX.jar creating: basex/bin/ inflating: basex/bin/basex inflating: basex/bin/basex.bat ... etc. $ echo '<x />' | basex/bin/basex -i- -q '.' /Users/rwalker/basex-report/basex/.basex: writing new configuration file. <x/>$ <-- shell prompt printed immediately after output $ echo -n '' | basex/bin/basex -i- -q '.' Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1371) at org.basex.util.MainParser.string(MainParser.java:110) at org.basex.BaseX.parseArgs(BaseX.java:235) at org.basex.core.CLI.<init>(CLI.java:50) at org.basex.BaseX.<init>(BaseX.java:55) at org.basex.BaseX.main(BaseX.java:42) $ echo '' | basex/bin/basex -i- -q '.' <mondial> <continent id="f0_119" name="Europe"/> <continent id="f0_123" name="Asia"/> <continent id="f0_126" name="America"/> <continent id="f0_129" name="Australia/Oceania"/> <continent id="f0_132" name="Africa"/> <country id="f0_136" name="Albania" capital="f0_1461" population="3249136" datacode="AL" total_area="28750" population_growth="1.34" infant_mortality="49.2" gdp_agri="55" gdp_total="4100" inflation="16" indep_date="28 11 1912" government="emerging democracy" car_code="AL"> <name>Albania</name> <city id="f0_1461" country="f0_136" longitude="10.7" latitude="46.2"> <name>Tirane</name> ... etc.