public string processFragment(string fragment, string csv) { usernames = csvToCollection(csv); Document document = new TestRig() .WithFixture(this) .ProcessFragment(fragment) .GetDocument(); var result = String.Empty; var table = (Element)document.getRootElement().query("//table").get(0); var rows = table.query(".//tr"); for (int i = 1; i < rows.size(); i++) { if (!result.Equals("")) { result += ", "; } result += categorize((Element)rows.get(i)); } return(result); }