我正在尝试阅读一些大型xml文件的这一部分:
---------------------
<SOL>
<LineDisc>109.90</LineDisc>
</SOL>
---------------------
我找到了办法,但我有一些疑问。
string testElement;
XmlDocument doc = new XmlDocument();
doc.Load(xmlFilePath);
XmlNodeList companyList = doc.GetElementsByTagName("SOL");
foreach (XmlNode node in companyList)
{
XmlElement companyElement = (XmlElement)node;
testElement = companyElement.GetElementsByTagName("LineDisc")[0].InnerText;
Console.WriteLine(companyElement.SelectSingleNode("LineDisc").Value);
Console.WriteLine(testElement);
}
按标签名称访问节点的第一种方法效果很好,但我的问题是,为什么我无法用SelectSingleNode
实现同样的目标?
答案 0 :(得分:1)
使用xml名称空间
public RequestCreator fit()
Attempt to resize the image to fit exactly into the target ImageView's bounds.
This will result in delayed execution of the request until the ImageView has been
laid out.
Note: This method works only when your target is an ImageView.