Hi Stephan,
Thanks for testing. I’m glad to hear that the bug you encountered seems to have been fixed.
Some background information regarding the general handling of quotes in command arguments: In earlier days, the only way to pass on multiple commands to BaseX on command line was to separate them with semicolons. An example:
basex -c "create db test <a/>; xquery ."
As a consequence, argument parsing imposed various restrictions (quotes were removed, semicolons served as end-of-command delimiters), and input to be replaced was usually supplied via file paths or via one of the other APIs. This is not valid anymore in more recent versions, however, as you can now specify multiple arguments one by one:
basex -c "create db test <a/>" -c "xquery ."
I have just revised our command string parser. With the very latest snapshot, the commands…
REPLACE path <a b='c'/> REPLACE path <a b="c"/> REPLACE path "<a b='c'/>"
...should now be parsed as expected. Optional double quotes at the start and the end of your argument will be removed, but I haven’t included support for escaping double quotes, because the backslashes might be an intentional part of the XML input. Instead, I recommend you to simply go with version 1.
Cheers, Christian
On Mon, Oct 1, 2018 at 9:23 AM Stephan van Hugten <Stephan.vanHugten@theapsgroup.com> wrote:
Hi Christian,
Thank you for your reply. I've tested with the 9.1-SNAPSHOT version and got the following results:
REPLACE com.example.model.user.Account-2397 <text version='draft'><title>Chapter</title></text>
1 resource(s) replaced in 2.89 ms.
REPLACE com.example.model.user.Account-2397 <text version="draft"><title>Chapter</title></text>
"com.example.model.user.Account-2397.xml" (Line 1): Open quote is expected for attribute "version" associated with an element type "text".
REPLACE com.example.model.user.Account-2397 "<text version="draft"><title>Chapter</title></text>"
"com.example.model.user.Account-2397.xml" (Line 1): Open quote is expected for attribute "version" associated with an element type "text".
Not sure that is what I'm expecting. It's good that single quotes now work, but does the Java command REPLACE replace all double quotes by single quotes if an XML string is passed as argument?
Kind regards,
Stephan