http://www.perlmonks.org?node_id=1046077


in reply to Re^2: create an xml file from column file
in thread create an xml file from column file

Ah! Then this is how I would do it:

  1. Loop over the lines of your input.
  2. Extract all word characters from the beginning of the line for the text field.
  3. Extract all word characters at the end of the line for the type field.
  4. Independently build the initial <text>...</text> and the <annotation>...</annotation> parts by adding them to two strings.
  5. After the loop print the two strings into an xml file.