Convert text (data) to xml structure format

Hi to all! This is my first post in this forum and I’ll try to best explain my problem.

I’m working on a AS3(AIR) application, i.e., some text transposer. Let’s say I have a dynamic textbox (some previously transposed data), in which I have the following content:


-1.66419
-1.65539
-1.63308
-1.47002
-1.42859
 1.00165
 1.00633
 1.00963
 1.01368
 1.01833

Next to this text box, I have another dynamic text box, where I want to put these numeric values, i.e., to generate an XML tree by clicking a button (calling a function), which have the following structure:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<values id="cpnn" minv = "0.00" intv = "0.50" maxv= "1.00">
  <val>
    <caption>-1.66419</caption>
  </val>
  <val>
    <caption>-1.65539</caption>
  </val>
  <val>
    <caption>-1.63308</caption>
  </val>
  <val>
    <caption>-1.47002</caption>
  </val>
  <val>
    <caption>-1.42859</caption>
  </val>
  <val>
    <caption>1.00165</caption>
  </val>
  <val>
    <caption>1.00633</caption>
  </val>
  <val>
    <caption>1.00963</caption>
  </val>
  <val>
    <caption>1.01368</caption>
  </val>
 <val>
    <caption>1.01833</caption>
  </val>
<values/>

How can I do that? Is there a solution? If someone have a solution, or in better case a source file, I’ll be very grateful!

Thanks in advance,
Nikola