public void ExposingXmlFragment() { string xml = @" <library> <book genre='novel' ISBN='1-861001-57-5'> <title>Pride And Prejudice</title> </book> <book genre='novel' ISBN='1-81920-21-2'> <title>Hook</title> </book> </library>"; XPathNavigator nav = new XPathDocument(new StringReader(xml)).CreateNavigator(); // <library> nav.MoveToFirstChild(); // <book> nav.MoveToFirstChild(); // Enable fragment reading. XPathNavigatorReader reader = new XPathNavigatorReader(nav, true); reader.MoveToContent(); string books = reader.ReadFragmentXml(); Assert.AreEqual( "<book genre=\"novel\" ISBN=\"1-861001-57-5\"><title>Pride And Prejudice</title></book><book genre=\"novel\" ISBN=\"1-81920-21-2\"><title>Hook</title></book>", books); }