title: Convert indented text to XML
body: <p>I have a text based file with indents that represent each XML tag of an XML file.</p>
  
  <p>How could I convert this text into a sample XML in C#?<br>
  I am a bit lost.  I have to count the spaces and look back in the list to determine when tags should close.</p>
  
  <pre><code>sampleroot                                          
    rootHeader                                        
      miscInformation                                 
          Creation                                
          DocumentIdentification                              
              Identifier                          
              Message_Type                            
              Notes                           
          StandardDocumentationIdentification                             
              Standard                            
              Version                         
      Receiver                                    
          Name                                
          lok                             
          Location                                
      Sender                                  
          Name                                
          lok2                                
      msgref                                  
          DocumentIdentifier                              
          HoldInformation                             
              Name                            
              Date                            
          ReleaseInformation                              
              Date                            
      HoldDocumentReference                                   
          AlternativeIdentifier                               
              Authority                           
              Identifier                          
          Notes                               
      ReleaseDocumentReference                                    
          AlternativeIdentifier                               
              Authority                           
              Identifier                          
          Notes       
  </code></pre>