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 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 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); }