title: XML Error: There are multiple root elements
body: <p>I am getting XML from a web service.  Here is what the XML looks like:</p>
  <pre><code>&lt;parent&gt;
      &lt;child&gt;
          Text
      &lt;/child&gt;
  &lt;/parent&gt;
  &lt;parent&gt;
      &lt;child&gt;
          &lt;grandchild&gt;
              Text
          &lt;/grandchild&gt;
          &lt;grandchild&gt;
              Text
          &lt;/grandchild&gt;
      &lt;/child&gt;
      &lt;child&gt;
          Text
      &lt;/child&gt;
  &lt;/parent&gt;
  
  etc.
  </code></pre>
  <p>And here is my C# code:</p>
  <pre><code>StringBuilder output = new StringBuilder();
  
  // Create an XmlReader
  using (XmlReader reader = XmlReader.Create(new StringReader(xoResponse.@return)))
  {
      XmlWriterSettings ws = new XmlWriterSettings();
      //ws.Indent = true;
      using (XmlWriter writer = XmlWriter.Create(output, ws))
      {
          // Parse the file and display each of the nodes.
          while (reader.Read())
          {
              switch (reader.NodeType)
              {
                  case XmlNodeType.Element:
                      writer.WriteStartElement(reader.Name);
                      break;
                  case XmlNodeType.Text:
                      writer.WriteString(reader.Value);
                      break;
                  case XmlNodeType.XmlDeclaration:
                  case XmlNodeType.ProcessingInstruction:
                      writer.WriteProcessingInstruction(reader.Name, reader.Value);
                      break;
                  case XmlNodeType.Comment:
                      writer.WriteComment(reader.Value);
                      break;
                  case XmlNodeType.EndElement:
                      writer.WriteFullEndElement();
                      break;
              }
          }
      }
  }
  </code></pre>
  <p>I believe that the error is thrown on the second parent element.  How can I avoid this error?  Any help is greatly appreciated.<img src="https://i.stack.imgur.com/rqIAW.jpg" alt="enter image description here" /></p>