A namespace manager or XsltContext is required. This query has prefix, variable or user-defined function and multi-attribute node query

first question,

1. First you need to introduce the namespace,

2. Secondly, when using xpath to find a node, bring the namespace again in the selectNodes and other methods

Such as

  XmlDocument doc = new XmlDocument();
            doc.Load(currentXbrl);
            XmlNamespaceManager nsp = new XmlNamespaceManager(doc.NameTable); // Import namespace 
            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); // Referencing the namespace again when looking for nodes

The second question, use and to connect multiple properties

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

refer to:

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

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324855760&siteId=291194637