/// <summary> Copies data from a group object into the corresponding group element, creating any /// necessary child nodes. /// </summary> private void encode(Genetibase.NuGenHL7.model.Group groupObject, System.Xml.XmlElement groupElement) { System.String[] childNames = groupObject.Names; System.String messageName = groupObject.Message.getName(); try { for (int i = 0; i < childNames.Length; i++) { Structure[] reps = groupObject.getAll(childNames[i]); for (int j = 0; j < reps.Length; j++) { System.Xml.XmlElement childElement = groupElement.OwnerDocument.CreateElement(makeGroupElementName(messageName, childNames[i])); groupElement.AppendChild(childElement); if (reps[j] is Group) { encode((Group) reps[j], childElement); } else if (reps[j] is Segment) { encode((Segment) reps[j], childElement); } } } } catch (System.Exception e) { throw new NuGenHL7Exception("Can't encode group " + groupObject.GetType().FullName, NuGenHL7Exception.APPLICATION_INTERNAL_ERROR, e); } }
public System.Xml.XmlNode ToXml(System.Xml.XmlNode node) { System.Xml.XmlDocument document; if (node is System.Xml.XmlDocument) document = (System.Xml.XmlDocument)node; else document = node.OwnerDocument; System.Xml.XmlNode Res = document.CreateElement("Index"); Res.Attributes.Append(node.OwnerDocument.CreateAttribute("table")); Res.Attributes["table"].Value = this.TableName; Res.Attributes.Append(node.OwnerDocument.CreateAttribute("name")); Res.Attributes["name"].Value = this.Name; Res.Attributes.Append(node.OwnerDocument.CreateAttribute("columns")); Res.Attributes["columns"].Value = string.Join(",", this.Columns.ToArray()); Res.Attributes.Append(node.OwnerDocument.CreateAttribute("unique")); Res.Attributes["unique"].Value = this.Unique ? "1" : "0"; Res.Attributes.Append(node.OwnerDocument.CreateAttribute("primary")); Res.Attributes["primary"].Value = this.Primary ? "1" : "0"; node.AppendChild(Res); return Res; }
public override System.Xml.XmlNode WriteTo(System.Xml.XmlNode parent) { XmlElement startProcessMethodsElement = parent.SelectSingleNode("child::" + name) as XmlElement; if (startProcessMethodsElement != null) { parent.RemoveChild(startProcessMethodsElement); } startProcessMethodsElement = parent.OwnerDocument.CreateElement(name); parent.AppendChild(startProcessMethodsElement); if (values != null) { foreach (ProcessMethod method in values) { XmlElement startMethodElement = parent.OwnerDocument.CreateElement("StartMethod"); startMethodElement.InnerText = method.MethodName; startProcessMethodsElement.AppendChild(startMethodElement); XmlAttribute sequenceAttribute = parent.OwnerDocument.CreateAttribute("Sequence"); sequenceAttribute.Value = method.Sequence.ToString(); startMethodElement.Attributes.Append(sequenceAttribute); } } return null; }
private static void HandleFolder(pstsdk.definition.pst.folder.IFolder rootfolder, System.Xml.XmlDocument doc, System.Xml.XmlNode node, string currpath, bool unicode) { uint messagecnt = (uint)rootfolder.MessageCount; uint attachcnt = (uint)rootfolder.Messages.Sum(x => x.AttachmentCount); System.Xml.XmlElement folderinfo = doc.CreateElement("folderinfo"); System.Xml.XmlNode folderinfonode = node.AppendChild(folderinfo); System.Xml.XmlElement numofmsg = doc.CreateElement("numOfMsg"); System.Xml.XmlNode numofmsgnode = folderinfonode.AppendChild(numofmsg); numofmsgnode.InnerText = messagecnt.ToString(); System.Xml.XmlElement numofattachments = doc.CreateElement("numOfAttachments"); System.Xml.XmlNode numofattachmentsnode = folderinfonode.AppendChild(numofattachments); numofattachmentsnode.InnerText = attachcnt.ToString(); System.Xml.XmlElement foldername = doc.CreateElement("foldername"); System.Xml.XmlNode foldernamenode = folderinfonode.AppendChild(foldername); System.Xml.XmlAttribute foldernameattrib = doc.CreateAttribute("type"); foldernameattrib.InnerText = unicode == true ? "PT_UNICODE" : "PT_ASCII"; foldernamenode.Attributes.Append(foldernameattrib); // if (currpath == "Root Container") // foldernamenode.InnerText = String.Format("cb: {0} lpb: {1}", 0, string.Empty); // else // { byte[] bytes = null; if (unicode == true) bytes = System.Text.UnicodeEncoding.Unicode.GetBytes(currpath); else bytes = System.Text.UnicodeEncoding.ASCII.GetBytes(currpath); foldernamenode.InnerText = String.Format("cb: {0} lpb: {1}", bytes.Length, bytes.Select(x => String.Format("{0:X2}", x)).Aggregate((i, j) => i + j)); // } System.Xml.XmlElement folderid = doc.CreateElement("folderid"); System.Xml.XmlNode folderidnode = folderinfonode.AppendChild(folderid); folderidnode.InnerText = rootfolder.EntryID.ToString(); }
/// <summary> /// Write this document's schema mappings to the given XML document /// </summary> /// <param name="doc"></param> /// <param name="currentNode"></param> protected override void WriteSchemaMappings(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode) { foreach (var el in _mappings) { currentNode.AppendChild(el); } }
internal virtual XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("pointmass"); grnode.AppendChild(gr); gr.SetAttribute("name", Name); gr.AppendChild(Location.CreateXmlNode(doc, "Pointmass "+Name)); gr.AppendChild(weight.CreateXmlNode(doc, "weight")); return gr; }
public override void AppendOwnSpecial(System.Xml.XmlElement messageElement) { var xmlDocument = messageElement.OwnerDocument; var userElement = xmlDocument.CreateElement("User"); userElement.SetAttribute("FriendlyName", this.User.FriendlyName); messageElement.AppendChild(userElement); }
CreateElement( string name, System.Xml.XmlDocument parent = null) { var element = Document.CreateElement(name, MSBuildNamespace); if (null != parent) { parent.AppendChild(element); } return element; }
private void CreateInfoNode(ref System.Xml.XmlNode node) { System.Xml.XmlNode infoNode = doc.CreateElement("INFO"); System.Xml.XmlNode nameNode = doc.CreateElement("NAME"); System.Xml.XmlNode typeNode = doc.CreateElement("TYPE"); nameNode.InnerText = TbxName.Text; typeNode.InnerText = CbxType.SelectedItem.ToString(); infoNode.AppendChild(nameNode); infoNode.AppendChild(typeNode); node.AppendChild(infoNode); }
protected override void WriteXml(object entity, System.Xml.XmlElement parent, IFormatProvider formatProvider, string localName, bool mandatory) { object value = GetValue(entity); if (value == null) { if (mandatory) { XmlElement element = parent.OwnerDocument.CreateElement(localName); parent.AppendChild(element); } } else { XmlElement element = parent.OwnerDocument.CreateElement(localName); parent.AppendChild(element); foreach (XmlAspectMember member in _Aspect) member.WriteXml(value, element, formatProvider); } }
internal virtual XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("force"); grnode.AppendChild(gr); gr.SetAttribute("name", name); gr.SetAttribute("frame", frame); gr.AppendChild(location.CreateXmlNode(doc)); gr.AppendChild(direction.CreateXmlNode(doc, null, "direction")); return gr; }
private void CreateChapterNode(int pid, System.Xml.XmlNode node) { System.Collections.ArrayList chapterList = contentService.GetChapterByPid(pid, Framework.Entity.Project.Type); foreach (Framework.Entity.Chapter chapter in chapterList) { System.Xml.XmlElement element = doc.CreateElement("CHAPTER"); element.SetAttribute("CID", System.Convert.ToString(chapter.Id)); element.SetAttribute("TITLE", chapter.Title); node.AppendChild(element); CreateChapterNode(chapter.Id, element); } }
AddResHeader( System.Xml.XmlDocument document, string name, string value, System.Xml.XmlElement parent) { var resHeader = document.CreateElement("resheader"); parent.AppendChild(resHeader); resHeader.SetAttribute("name", name); resHeader.InnerText = value; }
AddData( System.Xml.XmlDocument document, string name, string value, System.Xml.XmlElement parent) { var data = document.CreateElement("data"); parent.AppendChild(data); data.SetAttribute("name", name); var valueEl = document.CreateElement("value"); valueEl.InnerText = value; data.AppendChild(valueEl); }
internal virtual XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("contact"); grnode.AppendChild(gr); gr.SetAttribute("type", "STRUCTURE"); gr.SetAttribute("name", Name); gr.AppendChild(Location.CreateXmlNode(doc)); gr.AppendChild(static_friction.CreateXmlNode(doc, "static_friction")); gr.AppendChild(dynamic_friction.CreateXmlNode(doc, "dynamic_friction")); gr.AppendChild(rolling_friction.CreateXmlNode(doc, "rolling_friction")); gr.AppendChild(spring_coeff.CreateXmlNode(doc, "spring_coeff")); gr.AppendChild(damping_coeff.CreateXmlNode(doc, "damping_coeff")); return gr; }
/// <summary> /// Write out settings for the document /// </summary> /// <param name="oDatasetElement"></param> /// <param name="strDestFolder"></param> /// <param name="bDefaultResolution"></param> /// <returns></returns> internal override ExtractSaveResult Save(System.Xml.XmlElement oDatasetElement, string strDestFolder, DownloadSettings.DownloadCoordinateSystem eCS) { ExtractSaveResult result = base.Save(oDatasetElement, strDestFolder, eCS); System.Xml.XmlAttribute oPathAttr = oDatasetElement.OwnerDocument.CreateAttribute("file"); oPathAttr.Value = System.IO.Path.Combine(strDestFolder, System.IO.Path.ChangeExtension(tbFilename.Text, m_szExtension)); oDatasetElement.Attributes.Append(oPathAttr); System.Xml.XmlElement oDownloadElement = oDatasetElement.OwnerDocument.CreateElement("download_options"); Options.Document.DownloadOptions eOption = (Options.Document.DownloadOptions)cbDownload.SelectedIndex; oDownloadElement.InnerText = eOption.ToString(); oDatasetElement.AppendChild(oDownloadElement); return result; }
CreateElement( string name, string condition = null, string value = null, System.Xml.XmlElement parent = null) { var element = Document.CreateElement(name, MSBuildNamespace); if (null != parent) { parent.AppendChild(element); } if (null != condition) { CreateAttribute("Condition", condition, element); } if (null != value) { element.InnerText = value; } return element; }
internal XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode, int tank_index) { XmlElement gr = doc.CreateElement("tank"); gr.AppendChild(doc.CreateComment(String.Format("{0}: {1}", tank_index, Name))); grnode.AppendChild(gr); gr.SetAttribute("type", "FUEL"); gr.AppendChild(Location.CreateXmlNode(doc)); gr.AppendChild(Capacity.CreateXmlNode(doc, "capacity")); if (Standpipe != null) gr.AppendChild(Standpipe.CreateXmlNode(doc, "standpipe")); gr.AppendChild(Capacity.CreateXmlNode(doc, "contents")); { XmlElement p = doc.CreateElement("priority"); p.InnerText = Priority.ToString(); gr.AppendChild(p); } return gr; }
internal XmlElement CreateXmlNodes(System.Xml.XmlDocument doc, System.Xml.XmlElement grnode) { XmlElement gr = doc.CreateElement("engine"); grnode.AppendChild(gr); gr.SetAttribute("file", Name); gr.AppendChild(Location.CreateXmlNode(doc)); gr.AppendChild(Orient.CreateOrientXmlNode(doc,null,"orient")); foreach (var f in Feed) { XmlElement feed = doc.CreateElement("feed"); gr.AppendChild(feed); feed.InnerText = f.ToString(); } XmlElement th = doc.CreateElement("thruster"); gr.AppendChild(th); th.SetAttribute("file", "direct"); th.AppendChild(Location.CreateXmlNode(doc)); th.AppendChild(Orient.CreateOrientXmlNode(doc, null, "orient")); return gr; }
public System.Xml.XmlNode ToXml(System.Xml.XmlNode node) { System.Xml.XmlDocument document; if (node is System.Xml.XmlDocument) document = (System.Xml.XmlDocument)node; else document = node.OwnerDocument; System.Xml.XmlNode Res = document.CreateElement("Database"); node.AppendChild(Res); foreach (string Tabla in Lfx.Data.DataBaseCache.DefaultCache.GetTableNames()) { Res.AppendChild(Lfx.Workspace.Master.MasterConnection.GetTableStructure(Tabla, false).ToXml(Res)); } IDictionary<string, ConstraintDefinition> Keys = Lfx.Workspace.Master.MasterConnection.GetConstraints(); foreach (ConstraintDefinition Key in Keys.Values) { Res.AppendChild(Key.ToXml(Res)); } return Res; }
CreateVSElement( this System.Xml.XmlDocument document, string name, string value = null, string condition = null, System.Xml.XmlElement parentEl = null) { const string ns = "http://schemas.microsoft.com/developer/msbuild/2003"; var el = document.CreateElement(name, ns); if (null != value) { el.InnerText = value; } if (null != condition) { el.SetAttribute("Condition", condition); } if (null != parentEl) { parentEl.AppendChild(el); } return el; }
protected override void SaveUserData(System.Xml.XmlElement node) { System.Xml.XmlDocument doc = node.OwnerDocument; for (int i = 0; i < this.camViews.Count; i++) { System.Xml.XmlElement camViewElem = doc.CreateElement("CamView_" + i); node.AppendChild(camViewElem); this.camViews[i].SaveUserData(camViewElem); } }
/// <summary> /// Write this document's schema mappings to the given XML document /// </summary> /// <param name="doc"></param> /// <param name="currentNode"></param> protected override void WriteSchemaMappings(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode) { foreach (var schema in base._schemas) { var map = doc.CreateElement("SchemaMapping"); //NOXLATE map.SetAttribute("provider", "OSGeo.Gdal.3.2"); //NOXLATE map.SetAttribute("xmlns", "http://fdogrfp.osgeo.org/schemas"); //NOXLATE map.SetAttribute("name", schema.Name); //NOXLATE { var ctype = doc.CreateElement("complexType"); //NOXLATE var ctypeName = doc.CreateAttribute("name"); //NOXLATE ctypeName.Value = schema.Name + "Type"; //NOXLATE ctype.Attributes.Append(ctypeName); { var rasType = doc.CreateElement("complexType"); //NOXLATE var rasTypeName = doc.CreateAttribute("name"); //NOXLATE rasTypeName.Value = "RasterTypeType"; //NOXLATE rasType.Attributes.Append(rasTypeName); { var rasDef = doc.CreateElement("RasterDefinition"); //NOXLATE var rasDefName = doc.CreateAttribute("name"); //NOXLATE rasDefName.Value = "images"; //NOXLATE rasDef.Attributes.Append(rasDefName); foreach (var loc in _items.Values) { loc.WriteXml(doc, rasDef); } rasType.AppendChild(rasDef); } ctype.AppendChild(rasType); } map.AppendChild(ctype); } currentNode.AppendChild(map); } }
CreateRootProject( System.Xml.XmlDocument document) { var project = document.CreateVSElement("Project"); document.AppendChild(project); return project; }
private void CreateKeyValuePair( System.Xml.XmlDocument doc, System.Xml.XmlElement parent, string key, string value) { var keyEl = doc.CreateElement("key"); keyEl.InnerText = key; var valueEl = doc.CreateElement("string"); valueEl.InnerText = value; parent.AppendChild(keyEl); parent.AppendChild(valueEl); }
public override void SaveToXml(System.Xml.XmlElement xmlEl , System.Xml.XmlDocument doc) { base.SaveToXml(xmlEl, doc); xmlEl.SetAttribute("C", "1"); xmlEl.SetAttribute("FS" , ((int)this.Format).ToString() ); if(this._prompt) xmlEl.SetAttribute("PR", "1"); foreach(Object obj in this._mdxParameters) //calculated member references { if(obj is Dimension) // dimension { throw new NotImplementedException(); } else if(obj is Hierarchy) // hierarchy { System.Xml.XmlElement childEl=doc.CreateElement("H"); childEl.SetAttribute("UN" , obj.UniqueName); xmlEl.AppendChild(childEl); } else if(obj is Level) // level { System.Xml.XmlElement childEl=doc.CreateElement("L"); childEl.SetAttribute("UN" , obj.UniqueName); xmlEl.AppendChild(childEl); } else if(obj is Member) // member { Member mem=obj as Member; System.Xml.XmlElement childEl=doc.CreateElement("M"); mem.SaveToXml(childEl, doc); if(mem.Hierarchy!=this.Hierarchy) childEl.SetAttribute("H" , mem.Hierarchy.UniqueName); xmlEl.AppendChild(childEl); } } }
/// <summary> /// Writes the current element's content /// </summary> /// <param name="doc"></param> /// <param name="currentNode"></param> public void WriteXml(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode) { var cls = this.Parent.GetClass(this.SchemaName, this.ClassName); if (cls != null) { var ctype = doc.CreateElement("complexType"); //NOXLATE ctype.SetAttribute("name", Utility.EncodeFDOName(this.ClassName) + "Type"); //NOXLATE { var table = doc.CreateElement("Table"); //NOXLATE table.SetAttribute("name", this.ClassName); //NOXLATE ctype.AppendChild(table); PropertyDefinition geomProp = null; foreach (var prop in cls.Properties) { //If this is geometry, we'll handle it later if (prop.Name == cls.DefaultGeometryPropertyName) { geomProp = prop; continue; } //If this is a geometry mapped X/Y/Z property, skip it if (prop.Name == this.XColumn || prop.Name == this.YColumn || prop.Name == this.ZColumn) continue; var el = doc.CreateElement("element"); //NOXLATE el.SetAttribute("name", Utility.EncodeFDOName(prop.Name)); //NOXLATE var col = doc.CreateElement("Column"); //NOXLATE col.SetAttribute("name", prop.Name); //NOXLATE el.AppendChild(col); ctype.AppendChild(el); } //Append geometry mapping if (geomProp != null) { var el = doc.CreateElement("element"); //NOXLATE el.SetAttribute("name", geomProp.Name); //NOXLATE if (!string.IsNullOrEmpty(this.XColumn)) el.SetAttribute("xColumnName", this.XColumn); //NOXLATE if (!string.IsNullOrEmpty(this.YColumn)) el.SetAttribute("yColumnName", this.YColumn); //NOXLATE if (!string.IsNullOrEmpty(this.ZColumn)) el.SetAttribute("zColumnName", this.ZColumn); //NOXLATE ctype.AppendChild(el); } } currentNode.AppendChild(ctype); } }
/// <summary> /// Writes the current element's content /// </summary> /// <param name="doc"></param> /// <param name="currentNode"></param> public override void WriteXml(System.Xml.XmlDocument doc, System.Xml.XmlNode currentNode) { var en = Utility.EncodeFDOName(this.Name); var geom = doc.CreateElement("xs", "element", XmlNamespaces.XS); //NOXLATE geom.SetAttribute("name", en); //NOXLATE geom.SetAttribute("type", "fdo:RasterPropertyType"); //NOXLATE geom.SetAttribute("defaultImageXSize", XmlNamespaces.FDO, this.DefaultImageXSize.ToString()); //NOXLATE geom.SetAttribute("defaultImageYSize", XmlNamespaces.FDO, this.DefaultImageYSize.ToString()); //NOXLATE geom.SetAttribute("srsName", XmlNamespaces.FDO, this.SpatialContextAssociation); //NOXLATE //Write description node var anno = doc.CreateElement("xs", "annotation", XmlNamespaces.XS); //NOXLATE var docN = doc.CreateElement("xs", "documentation", XmlNamespaces.XS); //NOXLATE docN.InnerText = this.Description; geom.AppendChild(anno); anno.AppendChild(docN); currentNode.AppendChild(geom); }
public void LoadConfiguration(System.Xml.XmlNode configNode) { System.Xml.XmlNode node = configNode.SelectSingleNode("Active"); if (null == node) { node = configNode.OwnerDocument.CreateElement("Active"); node.InnerText = "false"; configNode.AppendChild(node); } bool mode = Convert.ToBoolean(node.Value); if (mode) radioButtonActivate.Checked = true; node = configNode.SelectSingleNode("SetLoadBehavior"); if (null == node) { node = configNode.OwnerDocument.CreateElement("SetLoadBehavior"); node.InnerText = "false"; configNode.AppendChild(node); } mode = Convert.ToBoolean(node.Value); if (mode) checkBoxRestoreLoadBehavior.Checked = true; node = configNode.SelectSingleNode("TrayNotify"); if (null == node) { node = configNode.OwnerDocument.CreateElement("TrayNotify"); node.InnerText = "false"; configNode.AppendChild(node); } mode = Convert.ToBoolean(node.Value); if (mode) radioButtonTray.Checked = true; }
/// <summary> /// Write out settings for the Grid dataset /// </summary> /// <param name="oDatasetElement"></param> /// <param name="strDestFolder"></param> /// <param name="bDefaultResolution"></param> /// <returns></returns> internal override ExtractSaveResult Save(System.Xml.XmlElement oDatasetElement, string strDestFolder, DownloadSettings.DownloadCoordinateSystem eCS) { // --- cannot reproject section data --- ExtractSaveResult result = base.Save(oDatasetElement, strDestFolder, DownloadSettings.DownloadCoordinateSystem.Native); System.Xml.XmlAttribute oPathAttr = oDatasetElement.OwnerDocument.CreateAttribute("file"); oPathAttr.Value = System.IO.Path.Combine(strDestFolder, System.IO.Path.ChangeExtension(Utility.FileSystem.SanitizeFilename(tbFilename.Text), TIF_EXT)); oDatasetElement.Attributes.Append(oPathAttr); System.Xml.XmlAttribute oResolutionAttr = oDatasetElement.OwnerDocument.CreateAttribute("resolution"); oResolutionAttr.Value = oResolution.ResolutionValueSpecific(eCS).ToString(CultureInfo.InvariantCulture); oDatasetElement.Attributes.Append(oResolutionAttr); System.Xml.XmlElement oDisplayElement = oDatasetElement.OwnerDocument.CreateElement("display_options"); Options.SectionPicture.DisplayOptions eDisplayOption = (Options.SectionPicture.DisplayOptions)cbDisplayOptions.SelectedIndex; oDisplayElement.InnerText = eDisplayOption.ToString(); oDatasetElement.AppendChild(oDisplayElement); return result; }