I can read an XML doc using LINQ when there is no namespace in the root but retrieve nothing when it is present.
The code is used to step through the document:
foreach (XElement element in doc.Descendants("Level1").Elements("Level2"))
I also tried to get the namespace
var ns = doc.Root.Name.Namespace
foreach (XElement element in doc.Descendants(ns + "Level1").Elements("Level2"))
The document is set out as
<?xml version="1.0" encoding="UTF-8"?>
<Root xmlns="xmlns://www.example.com/schema/root" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.11" xsi:type="FVDL">
<Level1>
<Level2>
etc
Can anyone point our where I am going wrong :)
Thanks