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); } }
static XmlDiffPathNodeList SelectAttributes(XmlDiffViewElement parentElement, string path) { Debug.Assert(path[0] == '@'); int pos = 1; XmlDiffPathNodeList nodeList = null; //NCOVER DOESN'T LIKE: for (;;) while (true) { 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); }
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; //NCOVER DOESN'T LIKE: for (;;) while (true) { 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); }