首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

读取一个回到XML,跪求大神.

2012-12-14 
读取一个返回XML,跪求大神...?xml version1.0 encodingutf-8?string xmlnshttp://tempuri.org/

读取一个返回XML,跪求大神...
<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org/">-4456116940642369971</string>


请问如何读取到里面的-4456...的数据?

跪求大神教教小弟....
[最优解释]
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(@"路径");
//如果从字符串加载:xmlDoc.LoadXml("xml文本字符串");
Response.Write(xmlDoc.DocumentElement.InnerText);
[其他解释]
 string xml = @" <?xml version=""1.0"" encoding=""utf-8""?><string xmlns=""http://tempuri.org/"">-4456116940642369971</string>";
            var txt = Regex.Match(xml, @"(?i)<string[^>]+>([^<]+)</string>").Groups[1].Value;
            Console.WriteLine(txt);
           
[其他解释]


System.Xml.Linq.XElement ele = XElement.Load("app.xml");
string va = ele.Value;


把这个

<?xml version="1.0" encoding="utf-8"?><string xmlns="http://tempuri.org/">-4456116940642369971</string>
XML字符串写成XML文件,然后使用linq去读取
[其他解释]
  XmlDocument xmlDoc=new XmlDocument();
  xmlDoc.Load(System.Web.HttpContext.Current.Server.MapPath("xml路径"));
  XmlNode xn = xmlDoc.SelectSingleNode("string ");
  string value=xn.InnerText;
[其他解释]
引用:
引用:XmlDocument xmlDoc=new XmlDocument();
  xmlDoc.Load(System.Web.HttpContext.Current.Server.MapPath("xml路径"));
  XmlNode xn = xmlDoc.SelectSingleNode("string ");
  strin……

1L不行吗?
[其他解释]
引用:
string xml = @" <?xml version=""1.0"" encoding=""utf-8""?><string xmlns=""http://tempuri.org/"">-4456116940642369971</string>";
            var txt = Regex.Match(xml, @"(?i)<string[^>]+……


这个是我自己写的一个类.没有用JS接受...跪求另外的读取方式....
[其他解释]
引用:
XmlDocument xmlDoc=new XmlDocument();
  xmlDoc.Load(System.Web.HttpContext.Current.Server.MapPath("xml路径"));
  XmlNode xn = xmlDoc.SelectSingleNode("string ");
  string value=xn.Inne……


未将对象引用到实例.还是获取不到节点....
[其他解释]
引用:
引用:引用:XmlDocument xmlDoc=new XmlDocument();
  xmlDoc.Load(System.Web.HttpContext.Current.Server.MapPath("xml路径"));
  XmlNode xn = xmlDoc.SelectSingleNode……


这个真心不行....
[其他解释]

引用:

XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(@"路径");
//如果从字符串加载:xmlDoc.LoadXml("xml文本字符串");
Response.Write(xmlDoc.DocumentElement.InnerText);


感谢,解决了....
[其他解释]
感谢各位.  还来了两位大神...十分感谢...

热点排行