Beispiel #1
0
		public void XPathDocumentLoading()
		{
			string xml = "<customer id='1' pp:id='aba' xmlns='urn-kzu' xmlns:pp='urn-pepenamespace'><pp:order /><order id='1'>Chocolates</order></customer>";

			XPathNavigator nav = new XPathDocument(new StringReader(xml)).CreateNavigator();

			XmlReader reader = new XPathNavigatorReader(nav);
			XPathNavigator clone = new XPathDocument(reader).CreateNavigator();
           
			clone.MoveToFirstChild();
			Assert.AreEqual("customer", clone.LocalName);
			Assert.AreEqual("urn-kzu", clone.NamespaceURI);

			clone.MoveToAttribute("id", "urn-pepenamespace");
			Assert.AreEqual("aba", clone.Value);

			clone.MoveToParent();
			clone.MoveToFirstChild();
			Assert.AreEqual("pp:order", clone.Name);
			Assert.IsTrue(clone.IsEmptyElement);			
		}