Skip to content

Instantly share code, notes, and snippets.

@mslot
Last active December 19, 2015 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mslot/5994861 to your computer and use it in GitHub Desktop.
Save mslot/5994861 to your computer and use it in GitHub Desktop.
This code snippet print out xml elements.
XDocument doc = XDocument.Load("input.xml");
XElement root = doc.Root;
foreach (XElement e in root.Elements("elementX"))
{
Console.WriteLine("Elements : " + e.Value);
}
foreach (XElement e in root.Descendants("elementX"))
{
Console.WriteLine("Descendants : " + e.Value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment