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>
<?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>
<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>
";
xml = Regex.Replace(xml, @"\<.{0,1}bookstore\>", "");