Hi Richard,

Newlines (i.e., whitespace-only, non-empty strings) were treated
identically to the "." file reference. As you can also supply absolute
and relative file and directory paths as arguments for the -i flag,
the factbook.xml file, which is located in a descendant directory of
your current directory, was opened instead and bound to the context
item.

This special case will now be checked. In addition, the error message
for empty strings will now be suppressed. Feel free to check out the
latest stable snapshot [1].

Best,
Christian

[1] http://files.basex.org/releases/latest/



> 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.
>

Reply via email to