Skip to content

Instantly share code, notes, and snippets.

@gscattolin
Created September 10, 2013 18:15
Show Gist options
  • Save gscattolin/6513329 to your computer and use it in GitHub Desktop.
Save gscattolin/6513329 to your computer and use it in GitHub Desktop.
Read XML using Linq
using System.Linq;
using Pdf_Rendering;
using System.IO;
using System.Reflection;
using System.Xml.Linq;
XNamespace namespacexml= "http://www.heidelberg.com";
if (Path.GetExtension(fn).ToLower() != ".xml") { Console.WriteLine("Input file not a pdf file"); return false; }
if (!File.Exists(fn)) { Console.WriteLine("Input file does not exist"); return false; }
XDocument doc = XDocument.Load(fn);
IEnumerable<XElement> st = doc.Descendants( namespacexml+ name_descendandts);
foreach (XElement el in st)
{
Console.WriteLine("El=" + el.ToString());
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment