xpath查询C#以获取xml节点值- [英] xpath Query C# to pull the xml node value-

查看:101
本文介绍了xpath查询C#以获取xml节点值-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


这是我的xml消息

< MessageList xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd ="http://www.w3.org/2001/XMLSchema" xmlns ="http://www.tr.com/schema/2009/1.1/MessageList">


正在尝试获取xmlns ="http://www.tr.com/schema/2009/1.1/MessageList">的值;使用xpath查询.

xpath查询应该返回"http://www.tr.com/schema/2009/1.1/MessageList".

请帮忙.

感谢advnace

Hi All,


this is my xml message

<MessageList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.tr.com/schema/2009/1.1/MessageList">


am trying to get the value of xmlns="http://www.tr.com/schema/2009/1.1/MessageList"> using xpath query.

xpath query suppose to return "http://www.tr.com/schema/2009/1.1/MessageList".

any help please.

Thanks in advnace

推荐答案

xmlns不是常规属性,它是名称空间.
在此处查看有关如何获取值的多种方法:
http://www.hanselman.com/blog/GetNamespacesFromAnXMLDocumentWithXPathDocumentAndLINQToXML.aspx [
xmlns is not a regular attribute, it is a namespace.
Check here for a number of ways on how to get the value:
http://www.hanselman.com/blog/GetNamespacesFromAnXMLDocumentWithXPathDocumentAndLINQToXML.aspx[^]


这篇关于xpath查询C#以获取xml节点值-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆