static XmlDiffPathNodeList SelectAllChildren(XmlDiffViewParentNode parentNode)
 {
     if (parentNode._childNodes == null)
     {
         OnNoMatchingNode("*");
         return(null);
     }
     else if (parentNode._childNodes._nextSibbling == null)
     {
         XmlDiffPathNodeList nodeList = new XmlDiffPathSingleNodeList();
         nodeList.AddNode(parentNode._childNodes);
         return(nodeList);
     }
     else
     {
         XmlDiffPathNodeList nodeList  = new XmlDiffPathMultiNodeList();
         XmlDiffViewNode     childNode = parentNode._childNodes;
         while (childNode != null)
         {
             nodeList.AddNode(childNode);
             childNode = childNode._nextSibbling;
         }
         return(nodeList);
     }
 }
Exemple #2
0
 /// <summary>
 /// Gets a list of the attributes for the specifed node
 /// and if applicable, its children.
 /// </summary>
 /// <param name="parentElement">The node which
 /// contains the attributes</param>
 /// <returns>List of attributes</returns>
 private static XmlDiffPathNodeList SelectAllAttributes(
     XmlDiffViewElement parentElement)
 {
     if (parentElement.Attributes == null)
     {
         OnNoMatchingNode("@*");
         return(null);
     }
     else if (parentElement.Attributes.NextSibling == null)
     {
         XmlDiffPathNodeList nodeList = new XmlDiffPathSingleNodeList();
         nodeList.AddNode(parentElement.Attributes);
         return(nodeList);
     }
     else
     {
         XmlDiffPathNodeList  nodeList = new XmlDiffPathMultiNodeList();
         XmlDiffViewAttribute curAttr  = parentElement.Attributes;
         while (curAttr != null)
         {
             nodeList.AddNode(curAttr);
         }
         return(nodeList);
     }
 }
        static XmlDiffPathNodeList SelectAttributes(XmlDiffViewElement parentElement, string path)
        {
            Debug.Assert(path[0] == '@');

            int pos = 1;
            XmlDiffPathNodeList nodeList = null;

            for (;;)
            {
                string name = ReadAttrName(path, ref pos);

                if (nodeList == null)
                {
                    if (pos == path.Length)
                    {
                        nodeList = new XmlDiffPathSingleNodeList();
                    }
                    else
                    {
                        nodeList = new XmlDiffPathMultiNodeList();
                    }
                }

                XmlDiffViewAttribute attr = parentElement.GetAttribute(name);
                if (attr == null)
                {
                    OnNoMatchingNode(path);
                }

                nodeList.AddNode(attr);

                if (pos == path.Length)
                {
                    break;
                }
                else if (path[pos] == '|')
                {
                    pos++;
                    if (path[pos] != '@')
                    {
                        OnInvalidExpression(path);
                    }
                    pos++;
                }
                else
                {
                    OnInvalidExpression(path);
                }
            }

            return(nodeList);
        }
 public OperationDescriptor( int opid, Type type )
 {
     _opid = opid;
     _type = type;
      _nodeList = new XmlDiffPathMultiNodeList();
 }
 /// <summary>
 ///  Constructor
 /// </summary>
 /// <param name="opid">Operation identification number</param>
 /// <param name="type">Type of change in the data</param>
 public OperationDescriptor(int opid, Type type)
 {
     this.operationId   = opid;
     this.operationType = type;
     this.nodeList      = new XmlDiffPathMultiNodeList();
 }
 public OperationDescriptor(int opid, Type type)
 {
     this._opid     = (ulong)opid;
     this._type     = type;
     this._nodeList = new XmlDiffPathMultiNodeList();
 }
 /// <summary>
 ///  Constructor
 /// </summary>
 /// <param name="opid">Operation identification number</param>
 /// <param name="type">Type of change in the data</param>
 public OperationDescriptor(int opid, Type type)
 {
     this.operationId = opid;
     this.operationType = type;
     this.nodeList = new XmlDiffPathMultiNodeList();
 }
Exemple #8
0
        /// <summary>
        /// Gets the list of child nodes below the position indicated
        /// </summary>
        /// <param name="parentNode">The current node</param>
        /// <param name="path">Proprietary path statement</param>
        /// <param name="startPos">Position in the path statement 
        /// at which to start collecting node objects.</param>
        /// <returns>list of child nodes</returns>
        /// <returns>List of nodes or attributes</returns>
        private static XmlDiffPathNodeList SelectChildNodes(
            XmlDiffViewParentNode parentNode,
            string path,
            int startPos) {
            int pos = startPos;
            XmlDiffPathNodeList nodeList = null;

            for (; ; ) {
                int nodePos = ReadPosition(path, ref pos);

                if (pos == path.Length) {
                    nodeList = new XmlDiffPathSingleNodeList();
                } else {
                    nodeList = new XmlDiffPathMultiNodeList();
                }
                if (nodePos <= 0 || nodePos > parentNode.SourceChildNodesCount) {
                    OnNoMatchingNode(path);
                }
                nodeList.AddNode(parentNode.GetSourceChildNode(nodePos - 1));

                if (pos == path.Length) {
                    break;
                } else if (path[pos] == '|') {
                    pos++;
                } else if (path[pos] == '-') {
                    pos++;
                    int endNodePos = ReadPosition(path, ref pos);
                    if (endNodePos <= 0 || endNodePos > parentNode.SourceChildNodesCount) {
                        OnNoMatchingNode(path);
                    }
                    while (nodePos < endNodePos) {
                        nodePos++;
                        nodeList.AddNode(parentNode.GetSourceChildNode(nodePos - 1));
                    }

                    if (pos == path.Length) {
                        break;
                    } else if (path[pos] == '|') {
                        pos++;
                    } else {
                        OnInvalidExpression(path);
                    }
                }
            }
            return nodeList;
        }
Exemple #9
0
 /// <summary>
 /// Gets a list of all node objects at and below the location
 /// specified.
 /// </summary>
 /// <param name="parentNode">Node at which to start</param>
 /// <returns>list of node objects</returns>
 private static XmlDiffPathNodeList SelectAllChildren(
     XmlDiffViewParentNode parentNode) {
     if (parentNode.ChildNodes == null) {
         OnNoMatchingNode("*");
         return null;
     } else if (parentNode.ChildNodes.NextSibbling == null) {
         XmlDiffPathNodeList nodeList = new XmlDiffPathSingleNodeList();
         nodeList.AddNode(parentNode.ChildNodes);
         return nodeList;
     } else {
         XmlDiffPathNodeList nodeList = new XmlDiffPathMultiNodeList();
         XmlDiffViewNode childNode = parentNode.ChildNodes;
         while (childNode != null) {
             nodeList.AddNode(childNode);
             childNode = childNode.NextSibbling;
         }
         return nodeList;
     }
 }
Exemple #10
0
        /// <summary>
        /// Gets a list of attribute objects based on the location
        /// specified.
        /// </summary>
        /// <param name="parentElement">Node at which to start the path search</param>
        /// <param name="path">Proprietary alphanumeric path statement</param>
        /// <returns>list of attribute objects</returns>
        private static XmlDiffPathNodeList SelectAttributes(
            XmlDiffViewElement parentElement,
            string path) {
            Debug.Assert(path[0] == '@');

            int pos = 1;
            XmlDiffPathNodeList nodeList = null;
            for (; ; ) {
                string name = ReadAttrName(path, ref pos);

                if (nodeList == null) {
                    if (pos == path.Length) {
                        nodeList = new XmlDiffPathSingleNodeList();
                    } else {
                        nodeList = new XmlDiffPathMultiNodeList();
                    }
                }

                XmlDiffViewAttribute attr = parentElement.GetAttribute(name);
                if (attr == null) {
                    OnNoMatchingNode(path);
                }
                nodeList.AddNode(attr);

                if (pos == path.Length) {
                    break;
                } else if (path[pos] == '|') {
                    pos++;
                    if (path[pos] != '@') {
                        OnInvalidExpression(path);
                    }
                    pos++;
                } else {
                    OnInvalidExpression(path);
                }
            }
            return nodeList;
        }
Exemple #11
0
 /// <summary>
 /// Gets a list of the attributes for the specifed node
 /// and if applicable, its children.
 /// </summary>
 /// <param name="parentElement">The node which 
 /// contains the attributes</param>
 /// <returns>List of attributes</returns>
 private static XmlDiffPathNodeList SelectAllAttributes(
     XmlDiffViewElement parentElement) {
     if (parentElement.Attributes == null) {
         OnNoMatchingNode("@*");
         return null;
     } else if (parentElement.Attributes.NextSibbling == null) {
         XmlDiffPathNodeList nodeList = new XmlDiffPathSingleNodeList();
         nodeList.AddNode(parentElement.Attributes);
         return nodeList;
     } else {
         XmlDiffPathNodeList nodeList = new XmlDiffPathMultiNodeList();
         XmlDiffViewAttribute curAttr = parentElement.Attributes;
         while (curAttr != null) {
             nodeList.AddNode(curAttr);
         }
         return nodeList;
     }
 }
        static XmlDiffPathNodeList SelectChildNodes(XmlDiffViewParentNode parentNode, string path, int startPos)
        {
            int pos = startPos;
            XmlDiffPathNodeList nodeList = null;

            for (;;)
            {
                int nodePos = ReadPosition(path, ref pos);

                if (pos == path.Length)
                {
                    nodeList = new XmlDiffPathSingleNodeList();
                }
                else
                {
                    nodeList = new XmlDiffPathMultiNodeList();
                }

                if (nodePos <= 0 || nodePos > parentNode._sourceChildNodesCount)
                {
                    OnNoMatchingNode(path);
                }

                nodeList.AddNode(parentNode.GetSourceChildNode(nodePos - 1));

                if (pos == path.Length)
                {
                    break;
                }
                else if (path[pos] == '|')
                {
                    pos++;
                }
                else if (path[pos] == '-')
                {
                    pos++;
                    int endNodePos = ReadPosition(path, ref pos);
                    if (endNodePos <= 0 || endNodePos > parentNode._sourceChildNodesCount)
                    {
                        OnNoMatchingNode(path);
                    }

                    while (nodePos < endNodePos)
                    {
                        nodePos++;
                        nodeList.AddNode(parentNode.GetSourceChildNode(nodePos - 1));
                    }

                    if (pos == path.Length)
                    {
                        break;
                    }
                    else if (path[pos] == '|')
                    {
                        pos++;
                    }
                    else
                    {
                        OnInvalidExpression(path);
                    }
                }
            }
            return(nodeList);
        }
 public OperationDescriptor(int opid, Type type)
 {
     _opid     = opid;
     _type     = type;
     _nodeList = new XmlDiffPathMultiNodeList();
 }