}//_GetComponentsXmlDoc protected XmlDocument _GetComponentAndChildren(int compID, string childType, bool isChildBaseType, IComponentOnlyOptions compOptions) { XmlElement topXmlNode; XmlDocument doc = this._GetComponentsXmlDoc(out topXmlNode); XmlElement xmlElement = this._GetXmlTree(doc, compID, childType, isChildBaseType, compOptions); if (xmlElement != null) { topXmlNode.AppendChild(xmlElement); } return doc; }//_GetComponentAndChildren
protected XmlElement _GetXmlTree(XmlDocument doc, DataRow component, IComponentOnlyOptions compOptions, SchemaDefaults schemaDefs, Dictionary<String, String> typeToBaseCache, Dictionary<String, XmlNode> typeToParametersXMLCache, Dictionary<String, List<DataRow>> parameterTableCache) { if (component == null) { return null; } string sCompType; string sBaseCompType; int iCompID; string sCompName; string sCompDesc; int? iLinkID = null; Component.eComponentType eCompEtype = Component.eComponentType.None; sCompType = (string)component[SchemaConstants.Type]; if (typeToBaseCache != null && typeToBaseCache.ContainsKey(sCompType)) { sBaseCompType = typeToBaseCache[sCompType]; } else { sBaseCompType = this._GetBaseComponentType(sCompType); if (typeToBaseCache != null) { typeToBaseCache.Add(sCompType, sBaseCompType); } } iCompID = (int)component[SchemaConstants.Id]; sCompName = (string)component[SchemaConstants.Name]; sCompDesc = (string)component[SchemaConstants.Description]; eCompEtype = this._GetComponentType(component); //LinkID if (component.Table.Columns.Contains(SchemaConstants.LinkID)) { iLinkID = (int)component[SchemaConstants.LinkID]; } XmlElement xmlElement = this.CommonElementCreate(doc, iCompID, iLinkID, sBaseCompType, sCompType, sCompName, sCompDesc, eCompEtype); // Component Parameters if (compOptions.CompParams) { IXPathNavigable clone = _GetParametersForComponent(component, typeToParametersXMLCache, parameterTableCache); if (clone != null) { XmlNode insert = ((XmlNode)clone).SelectSingleNode(XmlSchemaConstants.Display.sComponentParameters); insert = doc.ImportNode(insert, true); xmlElement.AppendChild(insert); } }//if Parameters //Link Parameters if (compOptions.LinkParams && iLinkID.HasValue) { IXPathNavigable clone = _GetParametersForLink(iLinkID.Value, typeToParametersXMLCache, parameterTableCache); if (clone != null) { XmlNode insert = ((XmlNode)clone).SelectSingleNode(XmlSchemaConstants.Display.sLinkParameters); insert = doc.ImportNode(insert, true); xmlElement.AppendChild(insert); } }//if Link Parameters //Functions if (schemaDefs != null) { XmlElement funcsElement = this._GetFunctionsForComponent(doc, iCompID, schemaDefs); if (funcsElement != null) { xmlElement.AppendChild(funcsElement); } }//if functions return xmlElement; }//_GetXmlTree
}//_GetXmlTree //bypass cache, e.g. single component lookup protected XmlElement _GetXmlTree(XmlDocument doc, DataRow component, IComponentOnlyOptions compOptions, SchemaDefaults schemaDefs) { return this._GetXmlTree(doc, component, compOptions, schemaDefs, null, null, null); }//_GetXmlTree
//bypass cache, e.g. single component lookup protected XmlElement _GetXmlTree(XmlDocument doc, int compID, IComponentOnlyOptions compOptions, SchemaDefaults schemaDefs) { return this._GetXmlTree(doc, this._GetComponent(compID), compOptions, schemaDefs, null, null, null); }//_GetXmlTree
private XmlElement _GetXmlTree(XmlDocument doc, DataRow component, string childType, bool isChildBaseType, IComponentOnlyOptions comOptions) { XmlElement xmlElement = null; //this._GetXmlTree(doc, compID, childType, isChildBaseType, compOptions) // DataTable _GetChildComponents(int compID, string childType, bool isChildBaseType) xmlElement = this._GetXmlTree( doc, component, comOptions, null, null, null, null); if (component != null) { //getting children int iCompID = (int)component[SchemaConstants.Id]; DataTable childComponents = null; childComponents = this._GetChildComponents(iCompID, childType, isChildBaseType); foreach (DataRow childComponent in childComponents.Rows) { XmlElement childElement = null; childElement = this._GetXmlTree( doc, childComponent, comOptions, null, null, null, null); xmlElement.AppendChild(childElement); }//foreach child component }//if component is not null (or say it exists) return xmlElement; }
}//_GetXmlTree private XmlElement _GetXmlTree(XmlDocument doc, int compID, string childType, bool isChildBaseType, IComponentOnlyOptions comOptions) { DataRow component = this._GetComponent(compID); return this._GetXmlTree(doc, component, childType, isChildBaseType, comOptions); }