public void Test_XmlNamespaceHelper_NoNamespaces()
        {
            string rawXml = @"
<root>
	<first>
		<item1 name=""Item 1"">
			<nested>Nested</nested>
		</item1>
		<item2>Item 2</item2>
	</first>
</root>
";

            var xml = XDocument.Parse(rawXml);
            var ns  = new XmlNamespaceHelper(xml, "x");
            var nsm = ns.NamespaceManager;

            XElement first;

            "".Dump("Element/Elements");
            first = xml.Root.Element(ns.GetXName("first"));
            first.Element(ns.GetXName("item1")).Attribute("name").Value.Dump();
            first.Element(ns.GetXName("item2")).Value.Dump();

            "".Dump("XPath");
            xml.XPathSelectElement("//first", nsm).Dump();
        }
        public void Test_XmlNamespaceHelper_WithNamespaces()
        {
            var rawXml = @"
<DIDL-Lite xmlns=""urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"" xmlns:dc=""http://purl.org/dc/elements/1.1/"" xmlns:upnp=""urn:schemas-upnp-org:metadata-1-0/upnp/"" xmlns:dlna=""urn:dlna"" xmlns:pv=""urn:pv"">
	<item id=""0$1$8I454669"" parentID=""0$1$8"" restricted=""1"">
		<dc:title>Eudaimonia Overture</dc:title>
		<dc:date>2008-01-01</dc:date>
		<upnp:genre>Metal</upnp:genre>
		<upnp:album>Silence Followed by a Deafening Roar</upnp:album>
		<upnp:originalTrackNumber>2</upnp:originalTrackNumber>
		<dc:creator>Paul Gilbert</dc:creator>
		<upnp:albumArtURI pv:profileID=""JPEG_TN"">
			http://100.100.200.4:9000/disk/DLNA-PNJPEG_TN-CI1-FLAGS00f00000/defaultalbumart/a_u_d_i_o.jpg/O0$1$8I454669.jpg?scale=160x160
		</upnp:albumArtURI>
		<upnp:artist>Paul Gilbert</upnp:artist>
		<pv:extension>mp3</pv:extension>
		<upnp:albumArtist>Paul Gilbert</upnp:albumArtist>
		<pv:modificationTime>1315020903</pv:modificationTime>
		<pv:addedTime>1448118086</pv:addedTime>
		<pv:lastUpdated>1315020903</pv:lastUpdated>
		<pv:pvItem name=""pvItem"">
			<dlna:nested name=""Nested"" />
		</pv:pvItem>
		<upnp:album_art>/tmp/0745a659d0f96aa26a477a03c27a416ce58d11d2</upnp:album_art>
		<res bitrate=""128"" resolution="""" colorDepth=""0"" duration=""0:04:36"" size=""4627468""
			protocolInfo=""http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000"">
				http://100.100.200.4:9000/disk/DLNA-PNMP3-OP01-FLAGS01700000/O0$1$8I454669.mp3</res>
		<upnp:class>object.item.audioItem.musicTrack</upnp:class>
	</item>
</DIDL-Lite>";

            var xml = XDocument.Parse(rawXml);
            var ns  = new XmlNamespaceHelper(xml, "x");
            var nsm = ns.NamespaceManager;

            "".Dump("Element/Elements");
            var first = xml.Root.Element(ns.GetXName("item"));

            first.Element(ns.GetXName("album", "upnp")).Value.Dump();
            first.Element(ns.GetXName("title", "dc")).Value.Dump();
            first.Element(ns.GetXName("res")).Attribute("duration").Value.Dump();

            "".Dump("XPath");
            xml.XPathSelectElement("//x:res", nsm).Attribute("size").Value.Dump();
            xml.XPathSelectElement("//pv:lastUpdated", nsm).Dump();
            xml.XPathSelectElement("//pv:pvItem", nsm).Attribute("name").Value.Dump();
            xml.XPathSelectElement("//dlna:nested", nsm).Attribute("name").Value.Dump();
        }