需要命名空间管理器或 XsltContext。此查询具有前缀、变量或用户定义的函数 及 多属性节点查询

第一个问题,

1. 首先需要引入命名空间,

2. 其次,在用xpath查找结点时,在selectNodes等方法中再次带入命名空间

  XmlDocument doc = new XmlDocument();
            doc.Load(currentXbrl);
            XmlNamespaceManager nsp = new XmlNamespaceManager(doc.NameTable); //导入命名空间
            nsp.AddNamespace("neeq", "http://www.neeq.com.cn/neeq/cor/2017-12-31");
            nsp.AddNamespace("so4217", "http://www.xbrl.org/2003/iso4217");
            nsp.AddNamespace("xbrldi", "http://xbrl.org/2006/xbrldi");
            nsp.AddNamespace("cas", "http://xbrl.mof.gov.cn/taxonomy/2015-03-31/cas");
            nsp.AddNamespace("ifrs-full", "http://xbrl.ifrs.org/taxonomy/2014-03-05/ifrs-full");
            string snode = "ifrs-full:ProfitLossAttributableToOwnersOfParent";
            
            XmlElement root = doc.DocumentElement;
            var xnodes = root.SelectNodes(snode, nsp);//在查找结点时再次引用命名空间

第二个问题,用and连接多个属性

var node=root.SelectSingleNode("OperatingRevenue[@contextRef='C_duration_20170101 - 20171231' and @unitRef='CNY'");

参考:

https://blog.csdn.net/jiangyu912/article/details/4676510

http://www.cnblogs.com/ifantastic/p/3670278.html

原文地址:https://www.cnblogs.com/ccjungle/p/8947136.html