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('<Id>CTN55</Id>')

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 = "<query><text>let $message:= fn:parse-xml('<Id>CTN58</Id>')" +

                    "return insert nodes $message as last into doc(\"calastone/calastone.xml\")</text>" +

                    "<variable name = 'message' value = fn:parse-xml('<Id>CTN58</Id>'))/></query>";

 

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.