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:

<query>

<text>

    let $message := '<Id>CTN53</Id>'

     return insert nodes $message as last into doc("calastone/calastone.xml")

</text>

<variable name='message' value='<Id>CTN53</ID>'/>

</query>

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 &lt; and &gt; for attributes and CDATA for text nodes. After applying that solution, the xml stored is in this form &lt;Id&gt;CTN53&lt;/Id&gt;

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.