public Tag getNode(String path) { String[] delim = { "\\" }; String[] tokens = path.Split(delim, StringSplitOptions.None); if (tokens.Length == 0) { throw new InvalidPathException("Node path is empty"); } else if (tokens.Length == 1 && tokens[0] == this.name) { return(this); } else { //find the node String nodeName = tokens[1]; Tag tag = this.findTagByName(nodeName); if (tag != null) { if (tokens.Length > 2) { //traverse the node path = path.Substring(path.IndexOf("\\") + 1); /**/ //Console.WriteLine("Found node"); //Console.WriteLine("Traversing to: " + path); byte tagType = tag.tagType; //check if the tag can be traversed if (tag.isSimpleTag()) { throw new InvalidPathException(Util.getTypeName(tagType) + " can't be traversed"); } else { return(tag.getNode(path)); } } else if (tokens.Length == 2) { return(tag); } } else { throw new InvalidPathException(path + " not found"); } } return(null); }