Exemplo n.º 1
0
        public PathMappingInstructions Get_Matching_Path_Instructions(GenericXmlPath Path, string AttributeName)
        {
            if (searchNodes.Count == 0)
            {
                build_search_tree();
            }

            // Look for a match
            if (searchNodes.ContainsKey(Path.PathNodes[0].NodeName))
            {
                GenericXmlMappingTreeNode lastMatchingNode = searchNodes[Path.PathNodes[0].NodeName];
                int index = 1;
                while (index < Path.PathNodes.Count)
                {
                    string nextNodeName = Path.PathNodes[index].NodeName;
                    if (!lastMatchingNode.Children.ContainsKey(nextNodeName))
                    {
                        return(null);
                    }

                    lastMatchingNode = lastMatchingNode.Children[nextNodeName];

                    index++;
                }

                // If there are instructions here, return them
                if ((lastMatchingNode.AttributeInstructions != null) && (lastMatchingNode.AttributeInstructions.ContainsKey(AttributeName)))
                {
                    return(lastMatchingNode.AttributeInstructions[AttributeName]);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        public bool Contains_Path(GenericXmlPath Path)
        {
            if (searchNodes.Count == 0)
            {
                build_search_tree();
            }

            // Look for a match
            if (searchNodes.ContainsKey(Path.PathNodes[0].NodeName))
            {
                GenericXmlMappingTreeNode lastMatchingNode = searchNodes[Path.PathNodes[0].NodeName];
                int index = 1;
                while (index < Path.PathNodes.Count)
                {
                    string nextNodeName = Path.PathNodes[index].NodeName;
                    if (!lastMatchingNode.Children.ContainsKey(nextNodeName))
                    {
                        return(false);
                    }

                    lastMatchingNode = lastMatchingNode.Children[nextNodeName];

                    index++;
                }

                // If there are instructions here, return them
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public GenericXmlMappingPath Add_Path(GenericXmlPath Path)
        {
            GenericXmlMappingPath addPath = new GenericXmlMappingPath(Path);

            Mappings.Add(addPath);
            return(addPath);
        }
 public GenericXmlPathValue(GenericXmlPath Path, string Value)
 {
     this.Path = Path;
     this.Value = Value;
 }
 public GenericXmlPathValue(GenericXmlPath Path, string Value)
 {
     this.Path  = Path;
     this.Value = Value;
 }
 /// <summary> Constructor for a new instance of the <see cref="GenericXmlMappingPath"/> class </summary>
 public GenericXmlMappingPath(GenericXmlPath XmlPath)
 {
     this.XmlPath = XmlPath;
     Instructions = new PathMappingInstructions();
 }