xml is XML is xml is XML I had to write some code for an interview, to print out the name attribute of each node. I started off going in the wrong direction, so I didn't get to finish.  I wanted to finish writing the code, so I created my console app similar to what they had a button event doing.  Please let me know what you think of the code and what I can do better.

class XMLRecursionReader
{
    private StringBuilder _outputString = new StringBuilder();
    private XmlNode _root;

    public XMLRecursionReader(XmlDocument xDoc)
    {
        _root = xDoc.ChildNodes[1]; 
    }
    public string ReturnNameAsString (XmlNode node)
    {
        return node.Attributes["name"].InnerXml.ToString();
    }
    public void buildString (XmlNode node)
    {
        _outputString.AppendLine(ReturnNameAsString(node));
        if (node.HasChildNodes)
        {
            foreach (XmlNode childNode in node.ChildNodes)
            {
                buildString(childNode);
            }
        }
    }
    public void PrintOutput ()
    {
        buildString(_root);
        Console.WriteLine(_outputString.ToString());
        Console.ReadLine();
    }
}


similar sample to what I was coding against.  but the code needed to be generic and able to go as deep as necessary depending on the document that was fed in, but the structure is always going to be similar to this.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;report name="ReportName"&gt;
    &lt;agency name="agency1"&gt;
        &lt;office name="office1"&gt;&lt;/office&gt;
        &lt;office name="office2"&gt;&lt;/office&gt;
        &lt;office name="office3"&gt;&lt;/office&gt;
    &lt;/agency&gt;
    &lt;agency name="agency2"&gt;
        &lt;office name="office1"&gt;
            &lt;agent name="agent Amy"&gt;&lt;/agent&gt;
    &lt;address name="address line"&gt;&lt;/address&gt;
        &lt;/office&gt;
        &lt;office name="office2"&gt;&lt;/office&gt;
        &lt;office name="office3"&gt;&lt;/office&gt;
    &lt;/agency&gt;
    &lt;agency name="agency3"&gt;
        &lt;office name="office1"&gt;
        &lt;agent name="agent Bettie"&gt;
            &lt;subagent name="sub-agent bob"&gt;
            &lt;phone name="456-789-1230"&gt;&lt;/phone&gt;
            &lt;/subagent&gt;
            &lt;subagent name="sub-agent billy"&gt;&lt;/subagent&gt;
        &lt;/agent&gt;
        &lt;address name="address line"&gt;
            &lt;faxnumber name="1234567890"&gt;&lt;/faxnumber&gt;
        &lt;/address&gt;     
        &lt;/office&gt;
        &lt;office name="office2"&gt;&lt;/office&gt;
        &lt;office name="office3"&gt;&lt;/office&gt;
    &lt;/agency&gt;
&lt;/report&gt;


The Results:
Naming
There are .NET Naming Guidelines which state that methods should be named using PascalCase casing. You haven't done this for buildString().
The code

The InnerXml property returns a string hence there is no need to call ToString() on the property.
Because all methods are public you should do proper parameter validation. At least you should check if the passed parameter is null and if yes throw an ArgumentNullException.
The PrintOutput () method does way too much. It builds the output, writes it to the console and reads a line from the console.
Because _root won't change you should make it readonly.
Calling PrintOutput twice results in doubling the printed value because you never reset/clear the StringBuilder.
The method name of ReturnNameAsString is too much. Because the method isn't void it is clear that it returns something. From looking at the returned type (string) it is clear what the method returns. Just call it GetNodeName instead.
The class name XMLRecursionReader exposes too much information about the implementation. A user of your code won't need to know that you solve the task by using recursion.
Both methods buildString and ReturnNameAsString should be private.
The if (node.HasChildNodes) in the buildString method is superflous because you are using a foreach to iterate over the ChildNodes. If there aren't any ChildNodes the foreach won't iterate.
The constructor assumes that the passed XmlDocument containes ChildNodes which may not be the case.