Пример #1
0
        private static void MarkInclusionStateForNodes(
            XmlNodeList nodeList,
            XmlDocument inputRoot,
            XmlDocument root)
        {
            CanonicalXmlNodeList canonicalXmlNodeList1 = new CanonicalXmlNodeList();
            CanonicalXmlNodeList canonicalXmlNodeList2 = new CanonicalXmlNodeList();

            canonicalXmlNodeList1.Add(inputRoot);
            canonicalXmlNodeList2.Add(root);
            int index1 = 0;

            do
            {
                XmlNode     xmlNode1    = canonicalXmlNodeList1[index1] ?? throw new InvalidOperationException();
                XmlNode     xmlNode2    = canonicalXmlNodeList2[index1] ?? throw new InvalidOperationException();
                XmlNodeList childNodes1 = xmlNode1.ChildNodes;
                XmlNodeList childNodes2 = xmlNode2.ChildNodes;
                for (int index2 = 0; index2 < childNodes1.Count; ++index2)
                {
                    canonicalXmlNodeList1.Add(childNodes1[index2]);
                    canonicalXmlNodeList2.Add(childNodes2[index2]);
                    if (Exml.NodeInList(childNodes1[index2], nodeList))
                    {
                        MarkNodeAsIncluded(childNodes2[index2]);
                    }
                    XmlAttributeCollection attributes = childNodes1[index2]?.Attributes;
                    if (attributes == null)
                    {
                        continue;
                    }

                    for (int index3 = 0; index3 < attributes.Count; ++index3)
                    {
                        if (Exml.NodeInList(attributes[index3], nodeList))
                        {
                            MarkNodeAsIncluded(childNodes2[index2]?.Attributes?.Item(index3));
                        }
                    }
                }
                ++index1;
            }while (index1 < canonicalXmlNodeList1.Count);
        }
Пример #2
0
        private static void MarkInclusionStateForNodes(
            XmlNodeList nodeList,
            XmlDocument inputRoot,
            XmlDocument root)
        {
            CanonicalXmlNodeList canonicalXmlNodeList1 = new CanonicalXmlNodeList();
            CanonicalXmlNodeList canonicalXmlNodeList2 = new CanonicalXmlNodeList();

            canonicalXmlNodeList1.Add((object)inputRoot);
            canonicalXmlNodeList2.Add((object)root);
            int index1 = 0;

            do
            {
                XmlNode     xmlNode1    = canonicalXmlNodeList1[index1];
                XmlNode     xmlNode2    = canonicalXmlNodeList2[index1];
                XmlNodeList childNodes1 = xmlNode1.ChildNodes;
                XmlNodeList childNodes2 = xmlNode2.ChildNodes;
                for (int index2 = 0; index2 < childNodes1.Count; ++index2)
                {
                    canonicalXmlNodeList1.Add((object)childNodes1[index2]);
                    canonicalXmlNodeList2.Add((object)childNodes2[index2]);
                    if (Exml.NodeInList(childNodes1[index2], nodeList))
                    {
                        ExcCanonicalXml.MarkNodeAsIncluded(childNodes2[index2]);
                    }
                    XmlAttributeCollection attributes = childNodes1[index2].Attributes;
                    if (attributes != null)
                    {
                        for (int index3 = 0; index3 < attributes.Count; ++index3)
                        {
                            if (Exml.NodeInList((XmlNode)attributes[index3], nodeList))
                            {
                                ExcCanonicalXml.MarkNodeAsIncluded(childNodes2[index2].Attributes.Item(index3));
                            }
                        }
                    }
                }
                ++index1;
            }while (index1 < canonicalXmlNodeList1.Count);
        }