public void ExtractDataAll(Element container) { var allMatchElements = ExtractContainerElements(container); if (allMatchElements != null && allMatchElements.Count > 0) { if (IsReturnCollection()) { string collectKey = GetCollectionKey(); Scope.ScopeId = collectKey; #region 集合直接处理子级 List <Dictionary <string, Object> > colist = new List <Dictionary <string, object> >(); foreach (var subContainer in allMatchElements) { Dictionary <string, Object> collectionItem = new Dictionary <string, object>(); if (childNodes.Count == 0) { ExtractDataByRuleMethods(subContainer); Dictionary <string, Object> nodeScopeObj = Scope.GetContainerObjectIteration(); ExtractScope.MergingScopeObjectWith(nodeScopeObj, collectionItem, true); } else { foreach (ExtractDataNode node in ChildNodes) { node.Scope.ContainerScope = Scope; node.ExtractDataAll(subContainer); Dictionary <string, Object> nodeScopeObj = node.Scope.GetContainerObjectIteration(); ExtractScope.MergingScopeObjectWith(nodeScopeObj, collectionItem, true); } } colist.Add(collectionItem); } Scope.Set(collectKey, colist); #endregion } else { foreach (var element in allMatchElements) { #region 本级处理 if (WhenNodeInContainer(container, element) != false) { ExtractDataByRuleMethods(element); } #endregion #region 子级处理 ExtractChild(element); #endregion if (ExtractFirstOnly() == true) { break; } } } } }
/// <summary> /// 从接口加载抽取文档定义 /// </summary> /// <param name="rule"></param> /// <returns></returns> public static ExtractTaskDocument FromExtractRule(IExtractDocumentRule rule) { ExtractTaskDocument doc = new ExtractTaskDocument(); doc.Scope.ScopeDeepth = 1; doc.Scope.ScopeId = "^"; doc.Scope.ContainerId = null; doc.SrcType = RuleLoadSource.Interface; ExtractScope.MergingScopeObjectWith(rule.StartupArguments(), doc.defaultArgs, true); XmlDocument xmlDoc = rule.RuleDocument(); doc.parseRuleDocument(xmlDoc); return(doc); }
public void DataBind(Dictionary <string, object> result) { ExtractScope.MergingScopeObjectWith(result, scopeResult, true); }