title: Writing updates to xml file with XQuery and BaseX
body: <p>I have a file.xml storing protocols whose structure is the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;economato&gt; 
    &lt;protocollo&gt;
      &lt;numero&gt;1&lt;/numero&gt;
      &lt;data&gt;2014-12-15&lt;/data&gt;
      &lt;oggetto&gt;Trasmissione prospetti di rendiconto chiusura esercizio 2012 - beni mobili proprietà dello stato&lt;/oggetto&gt;
      &lt;destinatario&gt;Ragioneria Provinciale Como&lt;/destinatario&gt;
      &lt;operatore&gt;MAESTRI&lt;/operatore&gt;
      &lt;valido&gt;true&lt;/valido&gt;
    &lt;/protocollo&gt;
    ...
  &lt;/economato&gt;
  </code></pre>
  
  <p>and I would need to change/update the value of the tag "valido", for example from 'true' to 'false' of the protocollo number 1 and I would like this update to be written into the file. As I am using BaseX, following the documentation I have tried to write this query:</p>
  
  <pre><code>xquery let $update := doc('C:\Users\Lorenzo Enzino  Vinci\Desktop\ECONOMATO\databases\2014.xml')//economato/protocollo[numero = 1] return replace value of node $update/valido with 'false' into doc('C:\Users\Lorenzo Enzino Vinci\Desktop\ECONOMATO\databases\2014.xml')//economato
  </code></pre>
  
  <p>but I get an error like </p>
  
  <pre><code>[XPST0003] Unexpected end of query: 'into doc('C:\Users\Lorenzo Enzino Vinci\Desktop\ECONOMATO\databases\2014.xml')//economato'
  </code></pre>
  
  <p>So my query is wrong but I do not know where. 
  Can you help me?</p>