title: Creating an XML Array with sed
body: <p>i'm parsing an xml file with XMLStarlet ; then i need to set that data in an xml array into another xml file .
  the problem is that i didn't get the data on my final xml.</p>
  
  <p>this is the xml that i'm parsing :</p>
  
  <pre><code>    &lt;service&gt;
          &lt;position&gt;3&lt;/position&gt;
          &lt;serviceType&gt;DescriptionScrollImages&lt;/serviceType&gt;
          &lt;icon&gt;gallerie_icon_.png&lt;/icon&gt;
          &lt;title&gt;SERVICES&lt;/title&gt;
          &lt;colorTitle&gt;#e2d5b2&lt;/colorTitle&gt;
          &lt;description&gt;cipaux centres d’intérêt : des monuments, des musées ainsi que le is des congrès.&lt;/description&gt;
          &lt;imageScroll&gt;
              &lt;imageName&gt;Photo_Gallerie_1.png&lt;/imageName&gt;
          &lt;/imageScroll&gt;
          &lt;imageScroll&gt;
              &lt;imageName&gt;Photo_Gallerie_2.png&lt;/imageName&gt;
          &lt;/imageScroll&gt;
          &lt;imageScroll&gt;
              &lt;imageName&gt;Photo_Gallerie_3.jpg&lt;/imageName&gt;
          &lt;/imageScroll&gt;
      &lt;/service&gt;
  </code></pre>
  
  <p>this is my script to parse this :</p>
  
  <p><strong>PS :servicetitle = SERVICES</strong>, i use it in a coomment ,like a tag, because i need to insert my items just before that tag , in order.</p>
  
  <pre><code>s=`xmlstarlet sel -t -v "count(/root/services/service/imageScroll)" /home/wissem/Bureau/app.xml`
  
  for j in `seq 1 $((s))`;
  do
  imagescroller=`xmlstarlet sel -t -m "//root/services/service/imageScroll[$j] " -v "."  -n /home/wissem/Bureau/app.xml`| sed -i "/&lt;\!\-\-"$servicetitle"\-\-&gt;/ i\&lt;item&gt;\@drawable\/'$imagescroller'&lt;\/item&gt;" /root/AndroidStudioProjects/RevolutionApp_T1/app/src/main/res/values/imageviewer.xml;
  cp $imagescroller /root/AndroidStudioProjects/RevolutionApp_T1/app/src/main/re/drawable-hdpi/
  
   done;;
  </code></pre>
  
  <p>what i have on output :</p>
  
  <pre><code>&lt;array name="SERVICES"&gt;
    &lt;item&gt;@drawable/''&lt;/item&gt;
    &lt;item&gt;@drawable/''&lt;/item&gt;
    &lt;item&gt;@drawable/''&lt;/item&gt;
    &lt;!--SERVICES--&gt;
  &lt;/array&gt;
  &lt;!--ENDTAG--&gt;
  </code></pre>
  
  <p>what it should be :</p>
  
  <pre><code>  &lt;array name="SERVICES"&gt;
     &lt;item&gt;@drawable/Photo_Gallerie_1.png&lt;/item&gt;
     &lt;item&gt;@drawable/Photo_Gallerie_2.png&lt;/item&gt;
     &lt;item&gt;@drawable/Photo_Gallerie_3.png&lt;/item&gt;
    &lt;!--SERVICES--&gt;
   &lt;/array&gt;
   &lt;!--ENDTAG--&gt;
  </code></pre>