日期:2014-05-17  浏览次数:20399 次

XML父节点问题,玩的熟的哥们儿看看
<?xml version="1.0" encoding="utf-8"?>
<bookstore>
  <book genre="ee" ISBN="2-3631-4">
    <title>三国演义</title>
    <author>lfdfd</author>
    <price>55.95</price>
  </book>
  <book ISBN="2-3631-4">
    <title>CS从入门到精通</title>
    <author>涨红</author>
    <price>58.3</price>
  </book>
  <book genre="计算机" ISBN="2-3631-4">
    <title>CS从入门到精通</title>
    <author>盖茨</author>
    <price>58.3</price>
  </book>
  <book genre="计算机" ISBN="2-3631-4">
    <title>CS从入门到精通</title>
    <author>盖茨</author>
    <price>58.3</price>
  </book>
</bookstore>

想把<bookstore></bookstore>这层节点删除掉,怎么实现下面效果:

<?xml version="1.0" encoding="utf-8"?>
  <book genre="ee" ISBN="2-3631-4">
    <title>三国演义</title>
    <author>lfdfd</author>
    <price>55.95</price>
  </book>
  <book ISBN="2-3631-4">
    <title>CS从入门到精通</title>
    <author>涨红</author>
    <price>58.3</price>
  </book>
  <book genre="计算机" ISBN="2-3631-4">
    <title>CS从入门到精通</title>
    <author>盖茨</author>
    <price>58.3</price>
  </book>
  <book genre="计算机" ISBN="2-3631-4">
    <title>CS从入门到精通</title>
    <author>盖茨</author>
    <price>58.3</price>
  </book>

------解决方案--------------------

    string xml=@"
            <?xml version=""1.0"" encoding=""utf-8""?>
<bookstore>
  <book genre=""ee"" ISBN=""2-3631-4"">
    <title>三国演义</title>
    &l