Пример #1
0
        protected override void ProcessUpdate()
        {
            ValidationManager vm = editor.ValidationManager;

            errorNode = node;

            // TODO: M: this is getting silly - confusion over parent/node
            if (parent != null && (node == null || node.NodeType != XmlNodeType.Text))
            {
                errorNode = parent;
            }

            // TODO: M: optimise this - location may not have changed

            if (errorNode == null)
            {
                return;
            }

            // TODO: H: check the performance of this for very large doc
            //			think about going around forward rather than looking back
            // TODO: H: have seen this throw null pointer
            XmlNodeList l = errorNode.SelectNodes("preceding::node()");
            int         c = l.Count;

            XmlNode[] nodes = new XmlNode[c];

            foreach (XmlNode n in l)
            {
                nodes[--c] = n;
            }

            preceding = FindErrorInList(nodes);
            following = FindErrorInList(errorNode.SelectNodes("following::node() | descendant::node()"));

            errors = new ValidationError[] {};
            while (errorNode != null)
            {
                errors = vm.GetErrorDetails(errorNode);
                if (errors.Length > 0)
                {
                    break;
                }

                errorNode = errorNode.ParentNode;
            }
        }