请问如何读取 book 的 ISBN 值??
XmL 格式如下
请问如何读取 book 的 ISBN 值??
C#该如何写….
<bookstore>
<book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
<title>The Confidence Man</title>
<author>
<first-name>Herman</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
</book>
<book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
<title>The Gorgias</title>
<author>
<name>Plato</name>
</author>
<price>9.99</price>
</book>
</bookstore>
问题点数:20、回复次数:2Top
1 楼du9232(木土四正)回复于 2005-08-02 12:26:04 得分 0
if (reader.NodeType == XmlNodeType.Element && reader.Name == "book")
{
while (reader.MoveToNextAttribute())
{
if (reader.Name == "ISBN")
{
dataFile = reader.Value;
}
}
}Top
2 楼lovefootball(蟑螂(生活就是扯淡--做人要放低姿态))回复于 2005-08-02 12:27:17 得分 0
通过node.Attributes就可以啊
先找到你要的node
可以用selectnodes或者XmlNode.SelectSingleNode
然后就可以读他的属性了
Top




