[英]Xml parsing with attribute
How to easily parse the xml response from a service. 如何轻松解析服务中的xml响应。 I want to deserialize this xml data to c# class.
我想将此XML数据反序列化为C#类。 Please give me a solution.
请给我一个解决方案。
<smil xmlns="http://www.w3.org/2005/SMIL21/Language">
<head>
<meta name="updateLockInterval" content="20" />
<meta name="lockId" content="EMK9KUpCkhGys3VrW8RCoQAH8NC7ELD1" />
<meta name="lockSequenceToken" content="SvTvwTjjuTl+1aVegeyuEIAb50M=" />
<meta name="lock" content="content" />
</head>
<body>
</body>
</smil>
I also want the values of name and content attribute. 我还想要name和content属性的值。
You could have use the following 您可以使用以下内容
XmlDocument xmlDoc = new XmlDocument();
load your xml document to xmlDoc 将您的xml文档加载到xmlDoc
XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("**Load the required node**");
then using a for loop iterate through each nodes and get the data. 然后使用for循环遍历每个节点并获取数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.