In our software we're using a Basex database and integrate with it via the Java library. We're currently using 8.0.3, but attempted to upgrade to the latest version (9.0.2) when we encountered a breaking issue. The REPLACE command class now interprets all XML with an attribute as a path. I can reproduce this in the basex command line client, but not the GUI.
Reproducer case:
BaseX 9.0.2 [Client] Try 'help' to get more information.
create db test
Database 'test' created in 25.24 ms.
open db test
Database 'db' was not found.
open test
Database 'test' was opened in 1.57 ms.
REPLACE com.example.model.user.Account-2397 "<text version="draft"><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version=draft><title>Chapter</title></text>"" not found.
REPLACE com.example.model.user.Account-2397 <text version="draft"><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version=draft><title>Chapter</title></text>"" not found.
REPLACE com.example.model.user.Account-2397 <text version='draft'><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE "com.example.model.user.Account-2397" <text version='draft'><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE "com.example.model.user.Account-2397" "<text version='draft'><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE top.xml "<text version='draft'><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE top.xml <xml/>
0 resource(s) replaced in 29.71 ms.
REPLACE top.xml <xml version='draft'/>
Resource "C:/Java/basex902/bin/"<xml version='draft'/>"" not found.
Storing the XML in a file and replacing that works:
REPLACE com.example.model.user.Account-95 test.xml
1 resource(s) replaced in 5.03 ms.
xquery //account
<account uuid="83ff82e4-01b1-4624-969e-2ba7e7deeb29" id="10095"><x/></account>
Can you assist in solving this mystery? '************************************************************************************************** This E-mail and any files transmitted with it are private and confidential and are solely for the use of the addressee. It may contain material which is legally privileged. If you are not the addressee, be advised that you have received this E-mail in error and that any use of it is strictly prohibited.
If you have received this E-mail in error, please notify APS on +44 (0)161 495 4500, or E-mail administrator@theapsgroup.com. Any opinions expressed in the E-mail are those of the individual writer of it and not necessarily the Company unless specifically stated otherwise. There is no intention to create any legally binding contract or other commitment through use of this E-mail
We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before downloading this E-mail and any attachments onto your computer system.
Allied Publicity Services (Manchester) Ltd Registered Office: Allied Publicity Services (Manchester) Ltd, Chetham House, Bird Hall Lane, Cheadle Heath, Cheshire, SK3 0ZP Company Registration No: 681528 England
APS Group Secure Solutions Limited. Registered Office: Chetham House, Bird Hall Lane, Stockport, Cheshire, SK3 0ZP Company Registration No: 07007434 England APS Group (Scotland) Ltd. Registered Office: APS Group (Scotland) Ltd, 21. Tennant Street, Edinburgh, EH6 5NA Company Registration No: SC369510 Scotland
______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit https://www.symantec.com ______________________________________________________________________
Hi Stephan,
I remember that another user encountered a similar issue in the recent past. Could you please check out if the problem also happens with the latest stable snapshot [1]?
Thanks in advance, Christian
[1] http://files.basex.org/releases/latest/
On Mon, Sep 3, 2018 at 3:21 PM Stephan van Hugten Stephan.vanHugten@theapsgroup.com wrote:
In our software we’re using a Basex database and integrate with it via the Java library. We’re currently using 8.0.3, but attempted to upgrade to the latest version (9.0.2) when we encountered a breaking issue. The REPLACE command class now interprets all XML with an attribute as a path. I can reproduce this in the basex command line client, but not the GUI.
Reproducer case:
BaseX 9.0.2 [Client]
Try 'help' to get more information.
create db test
Database 'test' created in 25.24 ms.
open db test
Database 'db' was not found.
open test
Database 'test' was opened in 1.57 ms.
REPLACE com.example.model.user.Account-2397 "<text version="draft"><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version=draft><title>Chapter</title></text>"" not found.
REPLACE com.example.model.user.Account-2397 <text version="draft"><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version=draft><title>Chapter</title></text>"" not found.
REPLACE com.example.model.user.Account-2397 <text version='draft'><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE "com.example.model.user.Account-2397" <text version='draft'><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE "com.example.model.user.Account-2397" "<text version='draft'><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE top.xml "<text version='draft'><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE top.xml <xml/>
0 resource(s) replaced in 29.71 ms.
REPLACE top.xml <xml version='draft'/>
Resource "C:/Java/basex902/bin/"<xml version='draft'/>"" not found.
Storing the XML in a file and replacing that works:
REPLACE com.example.model.user.Account-95 test.xml
1 resource(s) replaced in 5.03 ms.
xquery //account
<account uuid="83ff82e4-01b1-4624-969e-2ba7e7deeb29" id="10095"><x/></account>
Can you assist in solving this mystery?
'************************************************************************************************** This E-mail and any files transmitted with it are private and confidential and are solely for the use of the addressee. It may contain material which is legally privileged. If you are not the addressee, be advised that you have received this E-mail in error and that any use of it is strictly prohibited.
If you have received this E-mail in error, please notify APS on +44 (0)161 495 4500, or E-mail administrator@theapsgroup.com. Any opinions expressed in the E-mail are those of the individual writer of it and not necessarily the Company unless specifically stated otherwise. There is no intention to create any legally binding contract or other commitment through use of this E-mail
We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before downloading this E-mail and any attachments onto your computer system.
Allied Publicity Services (Manchester) Ltd Registered Office: Allied Publicity Services (Manchester) Ltd, Chetham House, Bird Hall Lane, Cheadle Heath, Cheshire, SK3 0ZP Company Registration No: 681528 England
APS Group Secure Solutions Limited. Registered Office: Chetham House, Bird Hall Lane, Stockport, Cheshire, SK3 0ZP Company Registration No: 07007434 England APS Group (Scotland) Ltd. Registered Office: APS Group (Scotland) Ltd, 21. Tennant Street, Edinburgh, EH6 5NA Company Registration No: SC369510 Scotland
This email has been scanned by the Symantec Email Security.cloud service. For more information please visit https://www.symantec.com ______________________________________________________________________
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
-----Original Message----- From: Christian Grün [mailto:christian.gruen@gmail.com] Sent: maandag 24 september 2018 15:54 To: Stephan van Hugten Stephan.vanHugten@theapsgroup.com Cc: BaseX basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] REPLACE command issue in Basex version 8.6.6/9.0.2
Hi Stephan,
I remember that another user encountered a similar issue in the recent past. Could you please check out if the problem also happens with the latest stable snapshot [1]?
Thanks in advance, Christian
[1] http://files.basex.org/releases/latest/
On Mon, Sep 3, 2018 at 3:21 PM Stephan van Hugten Stephan.vanHugten@theapsgroup.com wrote:
In our software we’re using a Basex database and integrate with it via the Java library. We’re currently using 8.0.3, but attempted to upgrade to the latest version (9.0.2) when we encountered a breaking issue. The REPLACE command class now interprets all XML with an attribute as a path. I can reproduce this in the basex command line client, but not the GUI.
Reproducer case:
BaseX 9.0.2 [Client]
Try 'help' to get more information.
create db test
Database 'test' created in 25.24 ms.
open db test
Database 'db' was not found.
open test
Database 'test' was opened in 1.57 ms.
REPLACE com.example.model.user.Account-2397 "<text version="draft"><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version=draft><title>Chapter</title></text>"" not found.
REPLACE com.example.model.user.Account-2397 <text version="draft"><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version=draft><title>Chapter</title></text>"" not found.
REPLACE com.example.model.user.Account-2397 <text version='draft'><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE "com.example.model.user.Account-2397" <text version='draft'><title>Chapter</title></text>
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE "com.example.model.user.Account-2397" "<text version='draft'><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE top.xml "<text version='draft'><title>Chapter</title></text>"
Resource "C:/Java/basex902/bin/"<text version='draft'><title>Chapter</title></text>"" not found.
REPLACE top.xml <xml/>
0 resource(s) replaced in 29.71 ms.
REPLACE top.xml <xml version='draft'/>
Resource "C:/Java/basex902/bin/"<xml version='draft'/>"" not found.
Storing the XML in a file and replacing that works:
REPLACE com.example.model.user.Account-95 test.xml
1 resource(s) replaced in 5.03 ms.
xquery //account
<account uuid="83ff82e4-01b1-4624-969e-2ba7e7deeb29" id="10095"><x/></account>
Can you assist in solving this mystery?
'********************************************************************* ***************************** This E-mail and any files transmitted with it are private and confidential and are solely for the use of the addressee. It may contain material which is legally privileged. If you are not the addressee, be advised that you have received this E-mail in error and that any use of it is strictly prohibited.
If you have received this E-mail in error, please notify APS on +44 (0)161 495 4500, or E-mail administrator@theapsgroup.com. Any opinions expressed in the E-mail are those of the individual writer of it and not necessarily the Company unless specifically stated otherwise. There is no intention to create any legally binding contract or other commitment through use of this E-mail
We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before downloading this E-mail and any attachments onto your computer system.
Allied Publicity Services (Manchester) Ltd Registered Office: Allied Publicity Services (Manchester) Ltd, Chetham House, Bird Hall Lane, Cheadle Heath, Cheshire, SK3 0ZP Company Registration No: 681528 England
APS Group Secure Solutions Limited. Registered Office: Chetham House, Bird Hall Lane, Stockport, Cheshire, SK3 0ZP Company Registration No: 07007434 England APS Group (Scotland) Ltd. Registered Office: APS Group (Scotland) Ltd, 21. Tennant Street, Edinburgh, EH6 5NA Company Registration No: SC369510 Scotland
This email has been scanned by the Symantec Email Security.cloud service. For more information please visit https://www.symantec.com ______________________________________________________________________
______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit https://www.symantec.com ______________________________________________________________________ '************************************************************************************************** This E-mail and any files transmitted with it are private and confidential and are solely for the use of the addressee. It may contain material which is legally privileged. If you are not the addressee, be advised that you have received this E-mail in error and that any use of it is strictly prohibited.
If you have received this E-mail in error, please notify APS on +44 (0)161 495 4500, or E-mail administrator@theapsgroup.com. Any opinions expressed in the E-mail are those of the individual writer of it and not necessarily the Company unless specifically stated otherwise. There is no intention to create any legally binding contract or other commitment through use of this E-mail
We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before downloading this E-mail and any attachments onto your computer system.
Allied Publicity Services (Manchester) Ltd Registered Office: Allied Publicity Services (Manchester) Ltd, Chetham House, Bird Hall Lane, Cheadle Heath, Cheshire, SK3 0ZP Company Registration No: 681528 England
APS Group Secure Solutions Limited. Registered Office: Chetham House, Bird Hall Lane, Stockport, Cheshire, SK3 0ZP Company Registration No: 07007434 England APS Group (Scotland) Ltd. Registered Office: APS Group (Scotland) Ltd, 21. Tennant Street, Edinburgh, EH6 5NA Company Registration No: SC369510 Scotland '************************************************************************************************** This E-mail and any files transmitted with it are private and confidential and are solely for the use of the addressee. It may contain material which is legally privileged. If you are not the addressee, be advised that you have received this E-mail in error and that any use of it is strictly prohibited.
If you have received this E-mail in error, please notify APS on +44 (0)161 495 4500, or E-mail administrator@theapsgroup.com. Any opinions expressed in the E-mail are those of the individual writer of it and not necessarily the Company unless specifically stated otherwise. There is no intention to create any legally binding contract or other commitment through use of this E-mail
We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before downloading this E-mail and any attachments onto your computer system.
Allied Publicity Services (Manchester) Ltd Registered Office: Allied Publicity Services (Manchester) Ltd, Chetham House, Bird Hall Lane, Cheadle Heath, Cheshire, SK3 0ZP Company Registration No: 681528 England
APS Group Secure Solutions Limited. Registered Office: Chetham House, Bird Hall Lane, Stockport, Cheshire, SK3 0ZP Company Registration No: 07007434 England APS Group (Scotland) Ltd. Registered Office: APS Group (Scotland) Ltd, 21. Tennant Street, Edinburgh, EH6 5NA Company Registration No: SC369510 Scotland
______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit https://www.symantec.com ______________________________________________________________________
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
basex-talk@mailman.uni-konstanz.de