title: Any Advantage to Giving All Collections a Separate Root Node in XML Documents?
body: <p>I haven't worked with XML files all that much. But I'm writing an app now that saves its data in XML format.</p>
  
  <p>So far, I've come up with the following basic structure.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;categories&gt;
    &lt;category id="cf6cb6bc-8142-4366-9b43-0ae6fce90df2"&gt;
      &lt;subcategories&gt;
        &lt;subcategory id="02b95e55-a4f7-4979-b0aa-a97f2c3327b0"&gt;
          &lt;articles&gt;
            &lt;article ... /&gt;
            &lt;article ... /&gt;
          &lt;/articles&gt;
        &lt;/subcategory&gt;
        &lt;subcategory id="5e9f9ef7-5190-4bcd-ab98-935d9208a4c7"&gt;
          &lt;articles&gt;
            &lt;article ... /&gt;
            &lt;article ... /&gt;
          &lt;/articles&gt;
        &lt;/subcategory&gt;
        &lt;subcategory id="7077d614-d3de-42d3-851a-b8c9ce0f56df"&gt;
          &lt;articles&gt;
            &lt;article ... /&gt;
            &lt;article ... /&gt;
          &lt;/articles&gt;
        &lt;/subcategory&gt;
      &lt;/subcategories&gt;
    &lt;/category&gt;
  &lt;/categories&gt;
  </code></pre>
  
  <p>But after looking at it, it seems like there are some unnecessary elements here, and that the same data could be shortened to the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;categories&gt;
    &lt;category id="cf6cb6bc-8142-4366-9b43-0ae6fce90df2"&gt;
      &lt;subcategory id="02b95e55-a4f7-4979-b0aa-a97f2c3327b0"&gt;
        &lt;article ... /&gt;
        &lt;article ... /&gt;
      &lt;/subcategory&gt;
      &lt;subcategory id="5e9f9ef7-5190-4bcd-ab98-935d9208a4c7"&gt;
        &lt;article ... /&gt;
        &lt;article ... /&gt;
      &lt;/subcategory&gt;
      &lt;subcategory id="7077d614-d3de-42d3-851a-b8c9ce0f56df"&gt;
        &lt;article ... /&gt;
        &lt;article ... /&gt;
      &lt;/subcategory&gt;
    &lt;/category&gt;
  &lt;/categories&gt;
  </code></pre>
  
  <p>It seems the file as a whole requires a root node. However, it doesn't appear all subcategories and articles also need a dedicated root nodes. So my shortened version just dumps all the subcategories directly under the category tag, and all the articles directly under the subcategory tag.</p>
  
  <p>Could someone who works more with XML files tell me if there's any reason at all not to use the shortened version above.</p>