title: Anonymous XML Elements
body: <p>I'm working on a piece of code that needs to be able to encode an arbitrary array to its XML representation.</p>
  
  <p>The problem seems to be that, besides a numeric index, array items do not have an identifier. This is a problem because XML does not have a concept of anonymous elements as far as I'm aware.</p>
  
  <p>Basically, I'd like to do this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;root&gt;
      &lt;array&gt;
          &lt;&gt;first item&lt;/&gt;
          &lt;&gt;second item&lt;/&gt;
          &lt;!-- ... --&gt;
          &lt;&gt;last item&lt;/&gt;
      &lt;/array&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Given the fact that XML names cannot be empty nor numeric, what's the next best thing?</p>
  
  <p>(Right now, I'm using each item's index number prefixed with an underscore as the element name.)</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I ended up choosing the generic term "item" as the element name for each array entry.</p>
  
  <pre><code>&lt;array&gt;
      &lt;item&gt;first item&lt;/item&gt;
      &lt;!-- ... --&gt;
      &lt;item&gt;last item&lt;/item&gt;
  &lt;/array&gt;
  </code></pre>
  
  <p>While technically not anonymous, I feel like this is abstract enough to consider those entries anonymous.</p>