Esempio n. 1
0
        internal void parseRuleDocument(XmlDocument xmlDoc)
        {
            XmlElement doc = xmlDoc.DocumentElement;

            foreach (XmlNode node in doc.ChildNodes)
            {
                ExtractNode extractNode = new ExtractNode(node, 1);
                NodeType    currentType = extractNode.GetExtractType();
                if (currentType == NodeType.Element)
                {
                    _extractNodes.Add(ExtractDataNode.ExtractNodeAll(node, extractNode.Deepth, this));
                }
                else if (currentType == NodeType.UrlPattern)
                {
                    EntryUrl = UrlPatternDatasource.FromXmlNode(node);
                }
                else if (currentType == NodeType.ScopeResult)
                {
                    DocumentResult = new ScopeResult(node, extractNode.Deepth);
                }
            }
        }
Esempio n. 2
0
        public static ExtractDataNode ExtractNodeAll(XmlNode node, int deepth, ExtractTaskDocument taskDoc)
        {
            ExtractDataNode eNode = new ExtractDataNode(node, deepth);

            eNode.OwnerTaskDocument = taskDoc;

            XmlNodeList nodesList = node.ChildNodes;

            if (nodesList != null && nodesList.Count > 0)
            {
                for (int i = 0, j = nodesList.Count; i < j; i++)
                {
                    XmlNode         subNode   = nodesList[i];
                    ExtractDataNode childNode = ExtractDataNode.ExtractNodeAll(subNode, deepth + 1, taskDoc);
                    string          pagerAttr = GetNodeNotNullAttrValue(subNode, "isPage");
                    if (!string.IsNullOrEmpty(pagerAttr) && Convert.ToBoolean(pagerAttr))
                    {
                        //分页节点定义
                        ExtractPagerNode pagerNode = new ExtractPagerNode(subNode, deepth + 1);
                        pagerNode.OwnerTaskDocument = taskDoc;
                        pagerNode.ParentExtractNode = eNode;

                        if (childNode.ChildNodes.Count > 0)
                        {
                            pagerNode.ChildNodes.AddRange(childNode.ChildNodes);
                        }
                        eNode.childNodes.Add(pagerNode);
                    }
                    else
                    {
                        childNode.OwnerTaskDocument = taskDoc;
                        childNode.ParentExtractNode = eNode;
                        eNode.ChildNodes.Add(childNode);
                    }
                }
            }
            return(eNode);
        }