コード例 #1
0
        public void markMutableElements()
        {
            Dom dom;

            if (parent is Dom)
            {
                dom = parent as Dom;
            }
            else if (parent is Test)
            {
                dom = (parent as Test).parent as Dom;
            }
            else
            {
                throw new PeachException("Parent is crazy type!");
            }

            var nav = new XPath.PeachXPathNavigator(dom);
            XPathNodeIterator nodeIter = null;

            foreach (Tuple <bool, string> item in mutables)
            {
                nodeIter = nav.Select(item.Item2);

                while (nodeIter.MoveNext())
                {
                    var dataElement = ((XPath.PeachXPathNavigator)nodeIter.Current).currentNode as DataElement;

                    if (dataElement != null)
                    {
                        markMutable(dataElement, item.Item1);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Test.cs プロジェクト: 751620780/Peach
        public void markMutableElements()
        {
            var nav = new XPath.PeachXPathNavigator(parent);

            foreach (var item in mutables)
            {
                var nodeIter = nav.Select(item.xpath);

                while (nodeIter.MoveNext())
                {
                    var dataElement = ((XPath.PeachXPathNavigator)nodeIter.Current).currentNode as DataElement;

                    if (dataElement != null)
                    {
                        dataElement.isMutable = item.mutable;
                        foreach (var child in dataElement.EnumerateAllElements())
                        {
                            child.isMutable = item.mutable;
                        }
                    }
                }
            }
        }