命名空间管理器或XsltContext需要 [英] Namespace Manager or XsltContext needed
本文介绍了命名空间管理器或XsltContext需要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想读以下,并在其中选择一个节点
i am trying to read the following and select a node in it
<ns1:OrderInfo xmlns:ns1="http://xxxxxx Some URL XXXX">
<pricing someAttrHere>
<childnodes>
</pricing>
</ns1:OrderInfo>
XmlDocument document = new XmlDocument();
document.Load(Server.MapPath("order.xml"));
XmlNamespaceManager manager = new XmlNamespaceManager(document.NameTable);
manager.AddNamespace("ns1", "http://xxxxxx Some URL XXXX");
query = "/ns1:OrderInfo/pricing";
XmlNodeList nodeList = document.SelectNodes(query);
但它总是给人命名空间管理器或XsltContext需要
but it always give "Namespace Manager or XsltContext needed"
,你可以在上面看到我使用的XmlNamespaceManager添加命名空间和仍然给错误 请帮忙
as you can see above i add namespace using XmlNamespaceManager and still give the error please any help
推荐答案
您需要的使用的你的XmlNamespaceManager还有:
You need to use your XmlNamespaceManager as well:
XmlNodeList nodeList = document.SelectNodes(query, manager);
这篇关于命名空间管理器或XsltContext需要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文