title: Generate XML document in R
body: <p>In the project I am working, I need to automatize the creation of an <code>XML</code> document depending on the user input. The part of using the user input to modify the <code>xml</code> document is okay for me but I am new in creating <code>xml</code> documents from scratch in R</p>
  
  <p>I am wondering if an <code>XML</code> document like the one below can be generated in R using the <code>XML</code> or <code>xml2</code> packages. So far, I have explored the <code>newXMLdoc</code>, <code>xml_new_document</code> and <code>xml_new_root</code> functions but I am not familiar with all the syntax needed to create such an <code>xml</code> file (which should be saved in a local path once finished)</p>
  
  <pre><code>&lt;session&gt;
    &lt;modelVersion&gt;1.0.0&lt;/modelVersion&gt;
    &lt;products&gt;
      &lt;product&gt;
        &lt;refNo&gt;1&lt;/refNo&gt;
        &lt;uri&gt;S1A_IW_GRDH_1SDV_20190818T175529_20190818T175554_028627_033D25_22ED.zip&lt;/uri&gt;
        &lt;productReaderPlugin&gt;class org.esa.s1tbx.io.sentinel1.Sentinel1ProductReaderPlugIn&lt;/productReaderPlugin&gt;
      &lt;/product&gt;
      &lt;product&gt;
        &lt;refNo&gt;2&lt;/refNo&gt;
        &lt;uri&gt;S2A_MSIL1C_20190823T061631_N0208_R034_T42TXS_20190823T081730.zip&lt;/uri&gt;
        &lt;productReaderPlugin&gt;class org.esa.s2tbx.dataio.s2.ortho.plugins.Sentinel2L1CProduct_Multi_UTM42N_ReaderPlugIn&lt;/productReaderPlugin&gt;
      &lt;/product&gt;
    &lt;/products&gt;
    &lt;views/&gt;
  &lt;/session&gt;
  </code></pre>