public override XmlElement ToParamElement() { XmlElement fieldNode = XmlUtils.CreateRootElement("field"); if (StringUtil.IsEmpty(this.id)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30001, null); } if (StringUtil.IsEmpty(FieldTypeEnumHelper.ToType(this.type))) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30002, this.id); } fieldNode.SetAttribute("id", this.id); fieldNode.SetAttribute("name", this.name); fieldNode.SetAttribute("type", FieldTypeEnumHelper.ToType(this.type)); //sub-value XmlElement complexValuesNode = XmlUtils.AppendElement(fieldNode, "complex-values"); ComplexValue cValue = this.complexValue; foreach (string keyFieldId in cValue.GetFieldKeySet()) { Field field = cValue.GetValueField(keyFieldId); XmlElement valueNode = field.ToParamElement(); XmlUtils.AppendElement(complexValuesNode, valueNode); } return(fieldNode); }
public override void GenerateCustomId(int count, string generatorName, XmlNode resultParent) { foreach (int customId in this.FCentralServerConnection.GenerateCustomIds(this.FAppId, generatorName, count)) { XmlUtils.AppendElement(resultParent, "CustomId").InnerText = customId.ToString(); } }
private void SaveToXml(XmlNode planNode, ArrayList savedPlans) { int num = savedPlans.IndexOf((object)this); if (num >= 0) { XmlUtils.SetAttr(planNode, "use", (num + 1).ToString()); } else { savedPlans.Add((object)this); XmlUtils.SetAttr(planNode, "Name", savedPlans.Count.ToString()); foreach (MetadataObjectView view in this.Views) { XmlUtils.SetAttr((XmlNode)XmlUtils.AppendElement(planNode, "query-view"), "name", view.Name); } foreach (MetadataProperty metadataProperty in this.Data) { XmlUtils.AppendElement(planNode, metadataProperty.Name); } foreach (AssociationRefLoadPlan link in (ArrayList)this.Links) { XmlNode xmlNode = (XmlNode)XmlUtils.AppendElement(planNode, link.Ref.Association.Property.Name); XmlUtils.SetAttr(xmlNode, "ref-class", link.Ref.RefClass.Name); link.Plan.SaveToXml(xmlNode, savedPlans); } foreach (ChildRefLoadPlan child in (ArrayList)this.Childs) { XmlNode planNode1 = (XmlNode)XmlUtils.AppendElement(planNode, child.ChildRef.ChildClass.IdentName); child.Plan.SaveToXml(planNode1, savedPlans); } } }
public override void GenerateIds(int count, XmlNode resultParent) { foreach (DataId id in this.FCentralServerConnection.GenerateIds(this.FAppId, count)) { XmlUtils.AppendElement(resultParent, "ID").InnerText = id.ToString(); } }
public XmlElement ToElement(String fieldId) { XmlElement rule = XmlUtils.CreateRootElement("rule"); if (StringUtil.IsEmpty(this.name)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_31001, fieldId); } if (StringUtil.IsEmpty(this.value)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_31002, fieldId); } rule.SetAttribute("name", this.name); rule.SetAttribute("value", this.value); if (!StringUtil.IsEmpty(exProperty)) { rule.SetAttribute("exProperty", this.exProperty); } //for Special if (this.name.Equals(RuleTypeEnumHelper.ToType(RuleTypeEnum.MAX_TARGET_SIZE_RULE))) { MaxTargetSizeRule mtsRule = (MaxTargetSizeRule)this; if (!StringUtil.IsEmpty(mtsRule.Unit)) { rule.SetAttribute("unit", mtsRule.Unit); } } if (this.name.Equals(RuleTypeEnumHelper.ToType(RuleTypeEnum.MIN_TARGET_SIZE_RULE))) { MinTargetSizeRule misRule = (MinTargetSizeRule)this; if (!StringUtil.IsEmpty(misRule.Unit)) { rule.SetAttribute("unit", misRule.Unit); } } if (this.name.Equals(RuleTypeEnumHelper.ToType(RuleTypeEnum.TIP_RULE))) { TipRule tipRule = (TipRule)this; if (!StringUtil.IsEmpty(tipRule.Url)) { rule.SetAttribute("url", tipRule.Url); } } if (this.name.Equals(RuleTypeEnumHelper.ToType(RuleTypeEnum.DEV_TIP_RULE))) { DevTipRule devTipRule = (DevTipRule)this; if (!StringUtil.IsEmpty(devTipRule.Url)) { rule.SetAttribute("url", devTipRule.Url); } } //depend element if (dependGroup != null && !dependGroup.IsEmpty()) { XmlElement depend = dependGroup.ToElement(); XmlUtils.AppendElement(rule, depend); } return(rule); }
public override XmlElement ToElement() { XmlElement fieldEle = base.ToElement(); XmlElement lgEle = this.labelGroup.ToElement(); XmlUtils.AppendElement(fieldEle, lgEle); return(fieldEle); }
protected void cmdUpdateCompression_Click(object sender, EventArgs e) { //Create XML Document XmlDocument xmlCompression = new XmlDocument(); //Root Element XmlNode nodeRoot = xmlCompression.CreateElement("compression"); //ExcludedMimeTypes Element XmlNode nodeExcludedMimeTypes = xmlCompression.CreateElement("excludedMimeTypes"); nodeRoot.AppendChild(nodeExcludedMimeTypes); //Add ExcludedMimeTypes string[] split = new string[1] { Environment.NewLine }; foreach (string strItem in txtExcludedMimeTypes.Text.Split(split, StringSplitOptions.RemoveEmptyEntries)) { if (strItem.Trim() != "") { XmlUtils.AppendElement(ref xmlCompression, nodeExcludedMimeTypes, "mimeType", strItem.Trim(), false); } } //ExcludedPaths Element XmlNode nodeExcludedPaths = xmlCompression.CreateElement("excludedPaths"); nodeRoot.AppendChild(nodeExcludedPaths); //Add ExcludedPaths foreach (string strItem in txtExcludedPaths.Text.Split(split, StringSplitOptions.RemoveEmptyEntries)) { if (strItem.Trim() != "") { XmlUtils.AppendElement(ref xmlCompression, nodeExcludedPaths, "path", strItem.Trim(), false); } } //Whitespace Element XmlUtils.AppendElement(ref xmlCompression, nodeRoot, "whitespace", txtWhitespaceFilter.Text, false, true); //Add Root element to document xmlCompression.AppendChild(nodeRoot); //Create XML declaration. XmlDeclaration xmlDeclaration = xmlCompression.CreateXmlDeclaration("1.0", "utf-8", null); xmlCompression.InsertBefore(xmlDeclaration, nodeRoot); //Save Compression file string strFile = Globals.ApplicationMapPath + "\\Compression.config"; File.SetAttributes(strFile, FileAttributes.Normal); xmlCompression.Save(strFile); }
private void XmlRequest_QueryAppList(XmlNode request, XmlNode response) { for (int index = 0; index < this.FApps.Count; ++index) { ApplicationMetadataXml fapp = this.FApps[index]; XmlNode node = (XmlNode)XmlUtils.AppendElement(response, "App"); XmlUtils.SetAttr(node, "ID", fapp.Id); XmlUtils.SetAttr(node, "Name", fapp.Name); } }
public static String WriteRuleXmlString(List <Field> fields) { XmlElement root = XmlUtils.CreateRootElement("itemRule"); foreach (Field field in fields) { XmlElement fieldNode = field.ToElement(); XmlUtils.AppendElement(root, fieldNode); } return(XmlUtils.FormatXml(XmlUtils.EscapeXml(root.OwnerDocument.InnerXml))); }
public override XmlElement ToElement() { XmlElement fieldNode = XmlUtils.CreateRootElement("field"); if (StringUtil.IsEmpty(this.id)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30001, null); } if (StringUtil.IsEmpty(FieldTypeEnumHelper.ToType(this.type))) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30002, this.id); } fieldNode.SetAttribute("id", this.id); fieldNode.SetAttribute("name", this.name); fieldNode.SetAttribute("type", FieldTypeEnumHelper.ToType(this.type)); if (this.rules != null && this.rules.Count > 0) { XmlElement rulesNode = XmlUtils.AppendElement(fieldNode, "rules"); foreach (Rule rule in this.rules) { XmlElement ruleNode = rule.ToElement(this.id); XmlUtils.AppendElement(rulesNode, ruleNode); } } if (this.options != null && this.options.Count > 0) { XmlElement optionsNode = XmlUtils.AppendElement(fieldNode, "options"); foreach (Option option in this.options) { XmlElement optionNode = option.ToElement(); XmlUtils.AppendElement(optionsNode, optionNode); } } if (defaultValueField != null) { XmlElement defaultValueEle = this.ToDefaultValueElement(); if (defaultValueEle != null) { XmlUtils.AppendElement(fieldNode, defaultValueEle); } } if (this.properties != null && this.properties.Count > 0) { XmlElement propertiesNode = XmlUtils.AppendElement(fieldNode, "properties"); foreach (Property.Property propertie in this.properties) { XmlElement propertyNode = XmlUtils.AppendElement(propertiesNode, "property"); propertyNode.SetAttribute("key", propertie.Key); propertyNode.SetAttribute("value", propertie.Value); } } return(fieldNode); }
public override XmlElement ToElement() { XmlElement fieldNode = base.ToElement(); XmlElement fieldsNode = XmlUtils.AppendElement(fieldNode, "fields"); if (this.fields != null && this.fields.Count > 0) { foreach (Field field in fields) { XmlElement fNode = field.ToElement(); XmlUtils.AppendElement(fieldsNode, fNode); } } return(fieldNode); }
private static void MakePrimaryClassCompletion(XmlElement classNode) { if (!XmlUtils.ContainsAttr((XmlNode)classNode, "data-table")) { classNode.SetAttribute("data-table", XmlUtils.NeedAttr((XmlNode)classNode, "name").Replace('/', '_')); } bool flag = false; foreach (XmlElement selectNode1 in classNode.SelectNodes("property")) { string attr = XmlUtils.GetAttr((XmlNode)selectNode1, "purpose", "data"); ApplicationMetadataXml.CopyAttrIfNotExists(selectNode1, "data-field", "name"); if (attr == "association" || attr == "aggregation") { ApplicationMetadataXml.SetAttrIfNotExists(selectNode1, "data-type", "string"); ApplicationMetadataXml.SetAttrIfNotExists(selectNode1, "data-length", "12"); if (string.IsNullOrEmpty(selectNode1.GetAttribute("ref-select-case"))) { ApplicationMetadataXml.SetAttrIfNotExists(selectNode1, "ref-property", "id"); } else { foreach (XmlElement selectNode2 in selectNode1.SelectNodes("case")) { ApplicationMetadataXml.SetAttrIfNotExists(selectNode2, "ref-property", "id"); } } } else if (attr == "id") { flag = true; } } if (flag) { return; } XmlElement xmlElement = XmlUtils.AppendElement((XmlNode)classNode, "property"); xmlElement.SetAttribute("purpose", "id"); xmlElement.SetAttribute("name", "id"); xmlElement.SetAttribute("caption", "Идентификатор"); xmlElement.SetAttribute("data-field", "OID"); xmlElement.SetAttribute("data-type", "string"); xmlElement.SetAttribute("data-length", "12"); }
public override XmlElement ToDefaultValueElement() { MultiCheckField defaultField = (MultiCheckField)base.defaultValueField; XmlElement valuesNode = XmlUtils.CreateRootElement("default-values"); List <Value> defaultValues = defaultField.GetValues(); if (defaultValues == null || defaultValues.Count == 0) { return(null); } foreach (Value value in defaultValues) { XmlElement valueNode = XmlUtils.AppendElement(valuesNode, "default-value"); valueNode.InnerText = value.PropertyValue; } return(valuesNode); }
public override XmlElement ToDefaultValueElement() { if (this.defaultValueField == null) { return(null); } ComplexField complexField = (ComplexField)this.defaultValueField; XmlElement defaultComplexValuesNode = XmlUtils.CreateRootElement("default-complex-values"); ComplexValue cValue = complexField.GetComplexValue(); foreach (String keyFieldId in cValue.GetFieldKeySet()) { Field field = cValue.GetValueField(keyFieldId); XmlElement valueNode = field.ToParamElement(); XmlUtils.AppendElement(defaultComplexValuesNode, valueNode); } return(defaultComplexValuesNode); }
public XmlElement ToElement() { XmlElement dependGroup = XmlUtils.CreateRootElement("depend-group"); dependGroup.SetAttribute("operator", this.operators); foreach (DependExpress dependExpress in dependExpressList) { XmlElement dependExpressElement = XmlUtils.AppendElement(dependGroup, "depend-express"); dependExpressElement.SetAttribute("fieldId", dependExpress.FieldId); dependExpressElement.SetAttribute("value", dependExpress.Value); dependExpressElement.SetAttribute("symbol", dependExpress.Symbol); } foreach (DependGroup dependGroupNode in dependGroupList) { XmlElement dependGroupElement = dependGroupNode.ToElement(); XmlUtils.AppendElement(dependGroup, dependGroupElement); } return(dependGroup); }
public XmlElement ToElement() { XmlElement labelGroupEle = XmlUtils.CreateRootElement("label-group"); labelGroupEle.SetAttribute("name", Name); foreach (Label label in labelList) { XmlElement labelElement = XmlUtils.AppendElement(labelGroupEle, "label"); labelElement.SetAttribute("name", label.Name); labelElement.SetAttribute("value", label.Value); labelElement.SetAttribute("desc", label.Desc); } foreach (LabelGroup labelGroup in labelGroupList) { XmlElement subLabelGroupElement = labelGroup.ToElement(); XmlUtils.AppendElement(labelGroupEle, subLabelGroupElement); } return(labelGroupEle); }
public override XmlElement ToParamElement() { XmlElement fieldNode = XmlUtils.CreateRootElement("field"); if (StringUtil.IsEmpty(this.id)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30001, null); } if (StringUtil.IsEmpty(FieldTypeEnumHelper.ToType(this.type))) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_30002, this.id); } fieldNode.SetAttribute("id", this.id); fieldNode.SetAttribute("name", this.name); fieldNode.SetAttribute("type", FieldTypeEnumHelper.ToType(this.type)); XmlElement valueNode = XmlUtils.AppendElement(fieldNode, "value"); valueNode.InnerText = value.PropertyValue; return(fieldNode); }
public XmlElement ToElement() { XmlElement option = XmlUtils.CreateRootElement("option"); if (StringUtil.IsEmpty(this.displayName)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_33001, null); } if (StringUtil.IsEmpty(this.value)) { throw new TopSchemaException(TopSchemaErrorCodeEnum.ERROR_CODE_33002, null); } option.SetAttribute("displayName", this.displayName); option.SetAttribute("value", this.value); //depend element if (dependGroup != null && !dependGroup.IsEmpty()) { XmlElement depend = dependGroup.ToElement(); XmlUtils.AppendElement(option, depend); } return(option); }
public override XmlElement ToDefaultValueElement() { if (this.defaultValueField == null) { return(null); } XmlElement fieldNode = XmlUtils.CreateRootElement("default-values"); MultiComplexField multiComplexField = (MultiComplexField)this.defaultValueField; foreach (ComplexValue complexValue in multiComplexField.GetComplexValues()) { XmlElement complexValuesNode = XmlUtils.AppendElement(fieldNode, "default-complex-values"); ComplexValue cValue = complexValue; foreach (string keyFieldId in cValue.GetFieldKeySet()) { Field field = cValue.GetValueField(keyFieldId); XmlElement valueNode = field.ToParamElement(); XmlUtils.AppendElement(complexValuesNode, valueNode); } } return(fieldNode); }
public object AddElement( object parentElement, string childElementName, string childElementText = "", bool childElementTextAsCDataSection = false) { XmlNode xmlNode = InMetaXmlUtils.TryGetXmlNode(parentElement); if (xmlNode != null) { return((object)new MsXmlNodeEmulator((XmlNode)XmlUtils.AppendElement(xmlNode, childElementName, childElementText))); } object ownerDocument = InMetaXmlUtils.InteropGetOwnerDocument(parentElement); object element = InMetaXmlUtils.InteropCreateElement(ownerDocument, childElementName); InMetaXmlUtils.InteropAppendChild(parentElement, element); if (!string.IsNullOrEmpty(childElementText)) { InMetaXmlUtils.InteropAppendChild(element, InMetaXmlUtils.InteropCreateTextNode(ownerDocument, childElementText)); } return(element); }
protected void UpdateCompression() { var xmlCompression = new XmlDocument(); XmlNode nodeRoot = xmlCompression.CreateElement("compression"); XmlNode nodeExcludedPaths = xmlCompression.CreateElement("excludedPaths"); nodeRoot.AppendChild(nodeExcludedPaths); foreach (string strItem in txtExcludedPaths.Text.Split('\r', '\n')) { if (!String.IsNullOrEmpty(strItem.Trim())) { XmlUtils.AppendElement(ref xmlCompression, nodeExcludedPaths, "path", strItem.Trim(), false); } } XmlUtils.AppendElement(ref xmlCompression, nodeRoot, "whitespace", txtWhitespaceFilter.Text, false, true); xmlCompression.AppendChild(nodeRoot); XmlDeclaration xmlDeclaration = xmlCompression.CreateXmlDeclaration("1.0", "utf-8", null); xmlCompression.InsertBefore(xmlDeclaration, nodeRoot); string strFile = Globals.ApplicationMapPath + "\\Compression.config"; File.SetAttributes(strFile, FileAttributes.Normal); xmlCompression.Save(strFile); }
/// <summary> /// Creates the DNN manifest. /// </summary> /// <param name="objDesktopModule">The obj desktop module.</param> private void CreateDnnManifest(DesktopModuleInfo objDesktopModule) { string filename = ""; _Name = objDesktopModule.ModuleName; //Create Manifest Document XmlDocument xmlManifest = new XmlDocument(); //Root Element XmlNode nodeRoot = xmlManifest.CreateElement("dotnetnuke"); nodeRoot.Attributes.Append(XmlUtils.CreateAttribute(xmlManifest, "version", "3.0")); nodeRoot.Attributes.Append(XmlUtils.CreateAttribute(xmlManifest, "type", "Module")); //Folders Element XmlNode nodeFolders = xmlManifest.CreateElement("folders"); nodeRoot.AppendChild(nodeFolders); //Folder Element XmlNode nodeFolder = xmlManifest.CreateElement("folder"); nodeFolders.AppendChild(nodeFolder); //Desktop Module Info nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "name", _Name)); nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "friendlyname", objDesktopModule.FriendlyName)); nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "foldername", objDesktopModule.FolderName)); nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "modulename", _Name)); nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "description", objDesktopModule.Description)); if (objDesktopModule.Version == Null.NullString) { objDesktopModule.Version = "01.00.00"; } nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "version", objDesktopModule.Version)); nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "businesscontrollerclass", objDesktopModule.BusinessControllerClass)); nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "version", objDesktopModule.Version)); nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "businesscontrollerclass", objDesktopModule.BusinessControllerClass)); if (objDesktopModule.CompatibleVersions != "") { nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "compatibleversions", objDesktopModule.CompatibleVersions)); } if (SupportsProbingPrivatePath) { nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "supportsprobingprivatepath", SupportsProbingPrivatePath.ToString())); } //Add Source files if (IncludeSource) { nodeFolder.AppendChild(XmlUtils.CreateElement(xmlManifest, "resourcefile", ResourceFileName)); } //Modules Element XmlNode nodeModules = xmlManifest.CreateElement("modules"); nodeFolder.AppendChild(nodeModules); //Get the Module Definitions for this Module ModuleDefinitionController objModuleDefinitionController = new ModuleDefinitionController(); ArrayList arrModuleDefinitions = objModuleDefinitionController.GetModuleDefinitions(objDesktopModule.DesktopModuleID); //Iterate through Module Definitions foreach (ModuleDefinitionInfo objModuleInfo in arrModuleDefinitions) { XmlNode nodeModule = xmlManifest.CreateElement("module"); //Add module definition properties nodeModule.AppendChild(XmlUtils.CreateElement(xmlManifest, "friendlyname", objModuleInfo.FriendlyName)); //Add Cache properties nodeModule.AppendChild(XmlUtils.CreateElement(xmlManifest, "cachetime", objModuleInfo.DefaultCacheTime.ToString())); //Get the Module Controls for this Module Definition ModuleControlController objModuleControlController = new ModuleControlController(); ArrayList arrModuleControls = objModuleControlController.GetModuleControls(objModuleInfo.ModuleDefID); //Controls Element XmlNode nodeControls = xmlManifest.CreateElement("controls"); nodeModule.AppendChild(nodeControls); //Iterate through Module Controls foreach (ModuleControlInfo objModuleControl in arrModuleControls) { XmlNode nodeControl = xmlManifest.CreateElement("control"); //Add module control properties XmlUtils.AppendElement(ref xmlManifest, nodeControl, "key", objModuleControl.ControlKey, false); XmlUtils.AppendElement(ref xmlManifest, nodeControl, "title", objModuleControl.ControlTitle, false); XmlUtils.AppendElement(ref xmlManifest, nodeControl, "src", objModuleControl.ControlSrc, true); XmlUtils.AppendElement(ref xmlManifest, nodeControl, "iconfile", objModuleControl.IconFile, false); XmlUtils.AppendElement(ref xmlManifest, nodeControl, "type", objModuleControl.ControlType.ToString(), true); XmlUtils.AppendElement(ref xmlManifest, nodeControl, "helpurl", objModuleControl.HelpURL, false); //Add control Node to controls nodeControls.AppendChild(nodeControl); //Determine the filename for the Manifest file (It should be saved with the other Module files) if (filename == "") { filename = Folder + "\\" + objDesktopModule.ModuleName + ".dnn"; } } //Add module Node to modules nodeModules.AppendChild(nodeModule); } //Files Element XmlNode nodeFiles = xmlManifest.CreateElement("files"); nodeFolder.AppendChild(nodeFiles); //Add the files foreach (PaFileInfo file in _Files) { XmlNode nodeFile = xmlManifest.CreateElement("file"); //Add file properties XmlUtils.AppendElement(ref xmlManifest, nodeFile, "path", file.Path, false); XmlUtils.AppendElement(ref xmlManifest, nodeFile, "name", file.Name, false); //Add file Node to files nodeFiles.AppendChild(nodeFile); } //Add Root element to document xmlManifest.AppendChild(nodeRoot); //Save Manifest file xmlManifest.Save(filename); }