Пример #1
0
        public override object GetOutput()
        {
#if NET_2_0
            if ((xpath == null) || (doc == null))
            {
                return(new XmlDsigNodeList(new ArrayList()));
            }
#else
            if (xpath == null)
            {
                return(new XmlDsigNodeList(new ArrayList()));
            }
#endif
            // evaluate every time since input or xpath might have changed.
            string x = null;
            for (int i = 0; i < xpath.Count; i++)
            {
                switch (xpath [i].NodeType)
                {
                case XmlNodeType.Text:
                case XmlNodeType.CDATA:
                case XmlNodeType.Element:
                    x += xpath [i].InnerText;
                    break;
                }
            }

            ctx = new XmlDsigXPathContext(doc);
            foreach (XmlNode n in xpath)
            {
                XPathNavigator    nav  = n.CreateNavigator();
                XPathNodeIterator iter = nav.Select("namespace::*");
                while (iter.MoveNext())
                {
                    if (iter.Current.LocalName != "xml")
                    {
                        ctx.AddNamespace(iter.Current.LocalName, iter.Current.Value);
                    }
                }
            }
            return(EvaluateMatch(doc, x));
        }