title: Adding new elements to XmlDocument that abide by XSD
body: <p>Currently, I'm adding elements to my XmlDocument using XPath notation for which I've written code to that places the element at the proper location in the file. With one exception. I don't know how to make it pay attention to the sequence rules defined in my XSD file.</p>
  
  <p>Is there a way to add an element to an XmlDocument so that is abides by the sequence define in the XSD that governs my XML file?</p>
  
  <p>For example, my xml document should look like:</p>
  
  <pre><code>&lt;rootTag&gt;
    &lt;area name="I define an area"&gt;
      &lt;description&gt;some text here&lt;/description&gt;
      &lt;point x="1" y="1" /&gt;
      &lt;point x="2" y="2" /&gt;
      &lt;point x="3" y="3" /&gt;
    &lt;/area&gt;
  &lt;/rootTag&gt;
  </code></pre>
  
  <p>Yet I get, depending on the order in which the user enters values for the child tags above:</p>
  
  <pre><code>&lt;rootTag&gt;
    &lt;area name="I define an area"&gt;
      &lt;point x="1" y="1" /&gt;
      &lt;point x="2" y="2" /&gt;
      &lt;point x="3" y="3" /&gt;
      &lt;description&gt;some text here&lt;/description&gt;
    &lt;/area&gt;
  &lt;/rootTag&gt;
  </code></pre>
  
  <p>To correct the above, I create a DataSet (named tempXmlDataset) from the XSD file. I pass the contents of the XmlDocument into tempXmlDataset and things get re-ordered appropriately.</p>
  
  <p>However, my problem is caused by an option for the first child of the XML document. This option is defined in the XSD to allow for "area", "line" or "point" objects. "area" and "line" both have "point" elements as children. But child "point" is not the same as "point" object. So, as you might already realize, tempXmlDataset.ReadXmlSchema(...) creates a "point" table which only has x and y in it. This is by definition of the children for "area" and "line". </p>
  
  <p>So when my code runs tempXmlDataset.ReadXml(...) the attributes for "point" object do not get read in because it sees "point" object as child "point".  Here's an example of "point" object:</p>
  
  <pre><code>&lt;rootTag&gt;
    &lt;point name="I define a point" x="3" y="3" otherAttributes=""&gt;
      &lt;description&gt;some text here&lt;/description&gt;
    &lt;/point&gt;
  &lt;/rootTag&gt;
  </code></pre>