[basex-talk] Testing if a database exists and if some files exist

2020-07-29 Thread Ramzi Hammouda
Hello BaseX team,

I'm building a C# application, I'm using Rest APIs, how can I test if a 
database exists or not when I launch my application, and create necessary 
db/files when they are missing ?

Thanks,
Ramzi

P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. 
Let's respect the environment together. Only print this message if necessary.


[basex-talk] Inserting a two double quoted attribute

2020-07-27 Thread Ramzi Hammouda
Hello BaseX team,

I need to insert a node that has an attribute with two double quotes.

An example:
let $message:='3.00'
return insert nodes fn:parse-xml-fragment($message)
as last into doc('testingdb/testing.xml')

The GBP attribute is with two " so it gives the error:
SAX: 
file://C:/Program$20Files(86)/BaseX/(Line1):
 whitespace expected, attribute name found.

How can I solve the issue?

P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. 
Let's respect the environment together. Only print this message if necessary.


[basex-talk] Handling saving errors

2020-07-06 Thread Ramzi Hammouda
Hello BaseX team,

We're developing an application where a command can result in saving data on 
multiple xml documents in the same database. We're using Rest APIs. Now, We're 
looking on handling saving errors. For example, if there were an error in 
saving data on a one document, then the saving of data on other documents must 
be canceled (even if there were successful updates, they must be canceled). How 
can this be implemented?



Thanks.


P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. 
Let's respect the environment together. Only print this message if necessary.


[basex-talk] Storing XML messages

2020-05-14 Thread Ramzi Hammouda
Hello BaseX team,

Using Resful API, I'm trying to make POST method update BaseX database, I want 
to insert an xml node to an existing document calastone.xml in calastone 
database , but the node contains '<', you replied to a previous email that I 
should use fn:parse-xml to make this happen without error.

I tried using the function fn:parse-xml, I had success with using it in BaseX 
GUI like this:

let $message := fn:parse-xml('CTN55')
return insert nodes $message as last into doc("calastone/calastone.xml")

But when I tried to do the same with POST method from my application with using 
this xquery:

string xquery = "let $message:= fn:parse-xml('CTN58')" +
"return insert nodes $message as last into 
doc(\"calastone/calastone.xml\")" +
"CTN58'))/>";

I get the error: "" (Line 1): Element type "variable" must be followed by 
either attribute specifications, ">" or "/>"

Can you help on how to do this insertion?

Thanks.


P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. 
Let's respect the environment together. Only print this message if necessary.


Re: [basex-talk] Storing xml message

2020-05-08 Thread Ramzi Hammouda

Thanks for the reply,

I tried using the function fn:parse-xml, I had success with using it in BaseX 
GUI like this:

let $message := fn:parse-xml('CTN55')
return insert nodes $message as last into doc("calastone/calastone.xml")

But when I tried to do the same with POST API method from my application with 
using this xquery:

string xquery = "let $message:= fn:parse-xml('CTN58')" +
"return insert nodes $message as last into 
doc(\"calastone/calastone.xml\")" +
"CTN58'))/>";

I get the error: "" (Line 1): Element type "variable" must be followed by 
either attribute specifications, ">" or "/>"

Can you help on how to do this insertion?

Thanks.


From: BaseX-Talk  On Behalf Of Omar 
Siam
Sent: mardi 21 avril 2020 13:09
To: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] Storing xml message


If you pass some XML in to your query as text (because that is the only thing 
you can have inside an attribute) you have to do a parse-xml (or 
parse-xml-fragment if its more like a sequence) and insert that.
Am 21.04.2020 um 12:33 schrieb Ramzi Hammouda:
Hello,
First, thanks for the effort you're putting it to help BaseX users.

I'm Using POST method to update BaseX database, I want to insert an xml node to 
an existing document calastone.xml in calastone database , if the node contains 
'<', it returns an error " Line 6): The value of attribute "value" associated 
with an element type "variable" must not contain the '<' character."
code:


let $message := 'CTN53'
 return insert nodes $message as last into doc("calastone/calastone.xml")



the same code without '<' adds the text correctly.
how to solve this problem?
Note that this is a  question I posted on Stackoverflow, 
Link<https://stackoverflow.com/questions/60456387/passing-in-xquery-with-basex-post-method/60456826?noredirect=1#comment106958333_60456826>.
Christian Grun suggested using  and  for attributes and CDATA for text 
nodes. After applying that solution, the xml stored is in this form 
IdCTN53/Id
This is not what I'm looking for. Is there any other more convenient solutions 
to store XML messages with Rest APIs? I know PUT method works fine but it 
overwrites the content of the document.
Thank you.


P Respectons ensemble l'environnement. N'imprimez ce message que si nécessaire. 
Let's respect the environment together. Only print this message if necessary.


[basex-talk] Storing xml message

2020-04-21 Thread Ramzi Hammouda
Hello,
First, thanks for the effort you're putting it to help BaseX users.

I'm Using POST method to update BaseX database, I want to insert an xml node to 
an existing document calastone.xml in calastone database , if the node contains 
'<', it returns an error " Line 6): The value of attribute "value" associated 
with an element type "variable" must not contain the '<' character."
code:


let $message := 'CTN53'
 return insert nodes $message as last into doc("calastone/calastone.xml")



the same code without '<' adds the text correctly.
how to solve this problem?
Note that this is a  question I posted on Stackoverflow, 
Link.
Christian Grun suggested using  and  for attributes and CDATA for text 
nodes. After applying that solution, the xml stored is in this form 
IdCTN53/Id
This is not what I'm looking for. Is there any other more convenient solutions 
to store XML messages with Rest APIs? I know PUT method works fine but it 
overwrites the content of the document.
Thank you.


P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. 
Let's respect the environment together. Only print this message if necessary.


[basex-talk] Create a document in a created database

2020-04-20 Thread Ramzi Hammouda
Hello BaseX team,
This may sound simple, but didn't find how to do it, what is the xquery for 
creating an empty xml document in a chosen database.
Thanks.

P Respectons ensemble l'environnement. N'imprimez ce message que si n?cessaire. 
Let's respect the environment together. Only print this message if necessary.


[basex-talk] How to improve the efficiency of data storing and data retrieving

2020-03-02 Thread Ramzi Hammouda
Hello BaseX team,
First of all, thank you for giving such a tremendous effort to help BaseX 
users, we appreciate it.

We’re developing an application that has the sole use of exchanging  XML 
messages with other clients, we chose BaseX to store messages in their xml 
format and used its RESTful APIs to update the database. Currently storing data 
in one xml document in one database, but this is not efficient because with 
time the document will be very large, thus storing and retrieving data from it 
will take more time.

  *   Can I select a number of xml nodes from the document without the rest? 
For example returning only the last 200 xml messages ? if yes how to make it 
happen with REST methods?

I thought about the solution of using multiple documents, so there is the 
possibility of retrieving data from one document at a time, but didn’t find a 
way to make this process automatic because there are number of issues I didn’t 
find a solution for:

  *   How can the application know the number and names of existing documents 
in the database , didn’t find an xquery for this.

Can you suggest better solutions ?

Thank you.


P Respectons ensemble l'environnement. N'imprimez ce message que si nécessaire. 
Let's respect the environment together. Only print this message if necessary.