如何在asp.net的文本框中显示xmldata [英] how to display xmldata into textbox in asp.net
本文介绍了如何在asp.net的文本框中显示xmldata的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string data=<item><name>pradeep</name></item> XmlDocument doc = new XmlDocument(); doc.LoadXml(data);
如何将值显示到文本框中.....
解决方案
尝试
使用ASP.NET 2.0和C#.NET显示XML数据 [ ^ ]
用于处理和构建简单XML文档的XML类 [ 字符串 data = " ; XmlDocument xmlDoc = 新 XmlDocument(); // 由于缺少XmlDeclaration,XmlDocument不会解析字符串数据.因此,下面是正确的xml格式. 字符串 completeXML = " +数据; xmlDoc.LoadXml(completeXML); // 使用XPath表达式获取名称节点 字符串 xPath = " ; XmlNode节点= xmlDoc.SelectSingleNode(xPath); textBox1.Text = node.InnerText;
您可以在此处了解有关XPath的信息: http://www.w3schools.com/XPath/default.asp [ ^ ].
hi
string data=<item><name>pradeep</name></item> XmlDocument doc = new XmlDocument(); doc.LoadXml(data);
how to dispaly the value into a textbox.....
解决方案
try
Displaying XML Data using ASP.NET 2.0 and C# .NET[^]
XML class for processing and building simple XML documents[^] might help.
string data = "<item><name>pradeep</name></item>"; XmlDocument xmlDoc = new XmlDocument(); //XmlDocument won't parse the string data as XmlDeclaration is missing. Hence below is the correct xml format. string completeXML = "<?xml version=\"1.0\"?>" + data; xmlDoc.LoadXml(completeXML); //using XPath expression to get to the name node string xPath = "/item/name"; XmlNode node = xmlDoc.SelectSingleNode(xPath); textBox1.Text = node.InnerText;
You can learn about XPath here: http://www.w3schools.com/XPath/default.asp[^].
这篇关于如何在asp.net的文本框中显示xmldata的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文