public string buildXml() { StringBuilder sb = new StringBuilder(); XmlWriterSettings setting = new XmlWriterSettings(); setting.Indent = true; //setting.Encoding = Encoding.UTF8; XmlWriter xmlWriter = XmlWriter.Create(sb, setting); xmlWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'"); try { //pricing xmlWriter.WriteStartElement("pricing"); { xmlWriter.WriteElementString("evaluationTime", this.evaluationTime_); xmlWriter.WriteElementString("itemCode", this.itemCode_); xmlWriter.WriteElementString("itemType", "stepDownKI"); //pricingParameter xmlWriter.WriteStartElement("pricingParameter"); { Standard_paraViewModel standparaVM = new Standard_paraViewModel(); MonteViewModel mvm = new MonteViewModel(); mvm.SimulationNum_ = this.simulationNum_.ToString(); standparaVM.MethodViewModel_ = mvm; standparaVM.CalculationAmountViewModel_ = new CalculationAmountViewModel(); standparaVM.CalculationAmountViewModel_.Amount_ = "10000"; standparaVM.CalculationAmountViewModel_.Currency_ = "KRW"; standparaVM.UnderlyingInfo_paraViewModel_ = new UnderlyingInfo_paraViewModel(); standparaVM.UnderlyingInfo_paraViewModel_.Underlying_paraViewModel_ = new ObservableCollection<Underlying_paraViewModel>(); standparaVM.UnderlyingInfo_paraViewModel_.CorrelationInfo_paraViewModel_ = this.correlationParaXL_.ViewModel_; foreach (var item in this.indexParaListXL_) { item.buildXml(); standparaVM.UnderlyingInfo_paraViewModel_.Underlying_paraViewModel_.Add(item.ViewModel_); } foreach (var item in this.curveParaListXL_) { item.buildXml(); if (item.UsingType_ == "discount") { standparaVM.DiscountCurve_paraViewModel_. YieldTermstructureViewModel_.Add(((YieldTermstructureXL)item).YieldCurveVM_); } } standparaVM.buildXml(xmlWriter); } xmlWriter.WriteEndElement(); } xmlWriter.WriteEndElement(); xmlWriter.Close(); this.resultStr_ = sb.ToString(); } catch (Exception e) { string buildXmlErrStr = "err while xml building process , " + e.Message; ErrorManager.setError(new Error(buildXmlErrStr)); errStr_ += buildXmlErrStr + "\n"; //errStr_ += e.Message + "\n"; } this.buildXmlFlag_ = true; return errStr_; }