SetAttribute() public method

public SetAttribute ( string name, string value ) : void
name string
value string
return void
        protected override void SaveReminderInternal(IReminder reminder, XmlElement reminderElement)
        {
            var ir = (IntervalReminder)reminder;

            reminderElement.SetAttribute("fromInterval", ir.FromInterval.ToString());
            reminderElement.SetAttribute("toInterval", ir.ToInterval.ToString());
        }
        private static void ApplyHashIfApplicable(XmlElement linkElement, Localization localization)
        {
            string target = linkElement.GetAttribute("target").ToLower();
            if (target != "anchored")
            {
                return;
            }

            string href = linkElement.GetAttribute("href");

            bool samePage = string.Equals(href,
                    HttpContext.Current.Request.Url.AbsolutePath, // TODO: should not be using HttpContext at this level
                    StringComparison.OrdinalIgnoreCase
                    );

            string linkTitle = GetLinkTitle(linkElement, localization);

            string fragmentId = string.Empty;
            if (!string.IsNullOrEmpty(linkTitle))
            {
                fragmentId = '#' + linkTitle.Replace(" ", "_").ToLower();
            }

            linkElement.SetAttribute("href", (!samePage ? href : string.Empty) + fragmentId);
            linkElement.SetAttribute("target", !samePage ? "_top" : string.Empty);
        }
 public override void SaveData(System.Xml.XmlElement element)
 {
     base.SaveData(element);
     element.SetAttribute("ObjectURL", m_object_url);
     element.SetAttribute("ObjectValue", m_object_value.ToString());
     element.SetAttribute("IsReturn", m_is_return.ToString());
 }
 public override void SaveConditionToXml(ICondition condition, XmlElement conditionElement)
 {
     var c = condition as TimeOfDayCondition;
     conditionElement.SetAttribute("start", c.StartTime.ToString());
     conditionElement.SetAttribute("end", c.EndTime.ToString());
     conditionElement.SetAttribute("shouldBeWithin", c.ShouldBeWithin.ToString());
 }
Beispiel #5
0
        /// <summary>
        /// utility function to write the simple setParameter.xml file
        /// </summary>
        /// <param name="loggingHelper"></param>
        /// <param name="parameters"></param>
        /// <param name="outputFileName"></param>
        private static void WriteManifestsToFile(Utilities.TaskLoggingHelper loggingHelper, Framework.ITaskItem[] items, string outputFileName)
        {
            Xml.XmlDocument document        = new System.Xml.XmlDocument();
            Xml.XmlElement  manifestElement = document.CreateElement("sitemanifest");
            document.AppendChild(manifestElement);
            if (items != null)
            {
                foreach (Framework.ITaskItem item in items)
                {
                    string         name            = item.ItemSpec;
                    Xml.XmlElement providerElement = document.CreateElement(name);
                    string         path            = item.GetMetadata("Path");
                    providerElement.SetAttribute("path", path);

                    string additionProviderSetting = item.GetMetadata("AdditionalProviderSettings");
                    if (!string.IsNullOrEmpty(additionProviderSetting))
                    {
                        string[] providerSettings = additionProviderSetting.Split(';');
                        foreach (string ps in providerSettings)
                        {
                            string value = item.GetMetadata(ps);
                            if (!string.IsNullOrEmpty(value))
                            {
                                providerElement.SetAttribute(ps, value);
                            }
                        }
                    }
                    manifestElement.AppendChild(providerElement);
                }
            }

            // Save the UTF8 and Indented
            SaveDocument(document, outputFileName, System.Text.Encoding.UTF8);
        }
 public virtual void WriteToXml(XmlElement parent)
 {
   parent.SetAttribute("projectId", GetProject().GetPersistentID());
   parent.SetAttribute("typeName", TypeName);
   parent.SetAttribute("methodName", FieldName);
   parent.SetAttribute("isIgnored", Explicit.ToString());
 }
        public void WritePictureXMLFile()
        {
            GlobalDataStore.Logger.Debug("Updating Pictures.xml ...");
            List <LabelX.Toolbox.LabelXItem> items        = new List <LabelX.Toolbox.LabelXItem>();
            DirectoryInfo PicturesRootFolderDirectoryInfo = new DirectoryInfo(PicturesRootFolder);

            LabelX.Toolbox.Toolbox.GetPicturesFromFolderTree(PicturesRootFolderDirectoryInfo.FullName, ref items);

            //items = alle ingelezen pictures. Nu gaan wegschrijven.
            System.Xml.XmlDocument doc  = new System.Xml.XmlDocument();
            System.Xml.XmlElement  root = doc.CreateElement("LabelXItems");

            foreach (LabelX.Toolbox.LabelXItem item in items)
            {
                System.Xml.XmlElement itemXML = doc.CreateElement("item");
                itemXML.SetAttribute("name", item.Name);
                itemXML.SetAttribute("hash", item.Hash);

                root.AppendChild(itemXML);
            }

            doc.AppendChild(root);

            MemoryStream ms = new MemoryStream();

            System.Xml.XmlTextWriter tw = new System.Xml.XmlTextWriter(ms, Encoding.UTF8);
            tw.Formatting = System.Xml.Formatting.Indented;
            doc.WriteContentTo(tw);
            doc.Save(PicturesRootFolder + "pictures.xml");


            tw.Close();
        }
 public override void SaveNotificationToXml(INotification notification, XmlElement notificationElement)
 {
     var n = notification as IconNotification;
     notificationElement.SetAttribute("notificationText", n.NotificationText);
     notificationElement.SetAttribute("flashIconPath", n.FlashIconPath);
     notificationElement.SetAttribute("flashCount", n.FlashCount.ToString());
 }
 public override void SaveNotificationToXml(INotification notification, XmlElement notificationElement)
 {
     var n = notification as PopupNotification;
     notificationElement.SetAttribute("notificationText", n.NotificationText);
     notificationElement.SetAttribute("caption", n.Caption);
     notificationElement.SetAttribute("icon", n.Icon.ToString());
 }
Beispiel #10
0
        public override bool ToXML(System.Xml.XmlElement myElement)
        {
            if (myElement != null)
            {
                this.Attributes.ToXML(myElement);
                base.ToXML(myElement);
                myElement.SetAttribute("type", StringCommon.GetNameByType(this.Type));
                myElement.SetAttribute("name", this.Name);
                if (this.Type == ElementType.HaveNotElement)
                {
                    myElement.SetAttribute("prifix", this.Prifix);
                    myElement.SetAttribute("postfix", this.Postfix);
                }

                myElement.SetAttribute("text", this.text);



                foreach (ZYSelectableElementItem eleItem in this.myList)
                {
                    XmlElement item = myElement.OwnerDocument.CreateElement(eleItem.GetXMLName());
                    myElement.AppendChild(item);
                    eleItem.ToXML(item);
                }
                return(true);
            }
            return(false);
        }
Beispiel #11
0
 public virtual void putIntoElement(XmlElement cur)
 {
     cur.SetAttribute("name", Name);
     cur.SetAttribute("owner", Owner);
     cur.SetAttribute("borrower", Borrower);
     cur.SetAttribute("category", Category);
 }
        internal MappingCondition(EDMXFile parentFile, EntitySetMapping entitySetMapping, XmlElement entitySetMappingElement, ModelEntityType modelEntityType, StoreMemberProperty discriminatorColumn, string discriminatorValue)
            : base(parentFile)
        {
            _entitySetMapping = entitySetMapping;
            _modelEntityType = modelEntityType;
            _discriminatorColumn = discriminatorColumn;

            string storeEntitySetName = discriminatorColumn.EntityType.EntitySet.Name;

            //get hold of the type mapping
            _entityTypeMapping = (XmlElement)entitySetMappingElement.SelectSingleNode("map:EntityTypeMapping[@TypeName=" + XmlHelpers.XPathLiteral(modelEntityType.FullName) + " or @TypeName=" + XmlHelpers.XPathLiteral("IsTypeOf(" + modelEntityType.FullName + ")") + " or @TypeName=" + XmlHelpers.XPathLiteral(modelEntityType.AliasName) + " or @TypeName=" + XmlHelpers.XPathLiteral("IsTypeOf(" + modelEntityType.AliasName + ")") + "]", NSM);
            if (_entityTypeMapping == null)
            {
                throw new ArgumentException("The entity type " + modelEntityType.Name + " is not a participant in this entity set mapping.");
            }

            _mappingFragment = (XmlElement)_entityTypeMapping.SelectSingleNode("map:MappingFragment[@StoreEntitySet=" + XmlHelpers.XPathLiteral(storeEntitySetName) + "]", NSM);
            if (_mappingFragment == null)
            {
                throw new ArgumentException("The store entityset " + storeEntitySetName + " is not a participant in this entity set mapping.");
            }

            _mappingCondition = EDMXDocument.CreateElement("Condition", NameSpaceURImap);
            _mappingCondition.SetAttribute("ColumnName", discriminatorColumn.Name);
            if (discriminatorValue != null)
            {
                _mappingCondition.SetAttribute("Value", discriminatorValue);
            }
            else
            {
                _mappingCondition.SetAttribute("IsNull", "true");
            }
            _mappingFragment.AppendChild(_mappingCondition);
        }
Beispiel #13
0
        /// <summary>
        /// Assigns each property of a class to an XML attribute for a given Element
        /// </summary>
        /// <param name="doc">XmlDocument used to create elements</param>
        /// <param name="obj">Class whose properties are to be serialized</param>
        /// <param name="elem">Element to add attributes to</param>
        /// <returns>The same XmlElement, for brevity of code</returns>
        static XmlElement PropsToXmlAttr(XmlDocument doc, object obj, XmlElement elem)
        {
            foreach (PropertyInfo pi in obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance))
            {
                if (pi.GetValue(obj) != null && pi.GetValue(obj).ToString() != "")
                {
                    DefaultValueAttribute dvAttr = (DefaultValueAttribute)Attribute.GetCustomAttribute(pi, typeof(DefaultValueAttribute));

                    if (dvAttr == null)
                    {
                        elem.SetAttribute(pi.Name, pi.GetValue(obj).ToString());
                    }
                    else
                    {
                        if(dvAttr.Value.ToLower() == pi.GetValue(obj).ToString().ToLower()) {
                            Console.WriteLine("Default value of {0} skipped for {1}", dvAttr.Value, pi.Name);
                        }
                        else 
                        {
                            Console.WriteLine("Default value of {0} overwritten by {1} for {2}", dvAttr.Value, pi.GetValue(obj).ToString(), pi.Name);
                            elem.SetAttribute(pi.Name, pi.GetValue(obj).ToString());
                        }
                    }
                }
            }
            return elem;
        }
        internal NavigationProperty(EDMXFile parentFile, ModelEntityType modelEntityType, string name, ModelAssociationSet modelAssociationSet, XmlElement entityTypeElement, string fromRoleName, string toRoleName)
            : base(parentFile)
        {
            _modelEntityType = modelEntityType;

            _propertyElement = EDMXDocument.CreateElement("NavigationProperty", NameSpaceURIcsdl);
            _propertyElement.SetAttribute("Relationship", modelAssociationSet.FullName);

            if (string.IsNullOrEmpty(fromRoleName) || string.IsNullOrEmpty(toRoleName))
            {
                if (modelAssociationSet.FromEntityType == _modelEntityType)
                {
                    fromRoleName = modelAssociationSet.FromRoleName;
                    toRoleName = modelAssociationSet.ToRoleName;
                }
                else
                {
                    fromRoleName = modelAssociationSet.ToRoleName;
                    toRoleName = modelAssociationSet.FromRoleName;
                }
            }

            _propertyElement.SetAttribute("FromRole", fromRoleName);
            _propertyElement.SetAttribute("ToRole", toRoleName);

            entityTypeElement.AppendChild(_propertyElement);

            Name = name;
        }
		internal void SaveCecilXml (XmlElement elem)
		{
			elem.SetAttribute ("name", name);
			elem.SetAttribute ("type", type.FullName);
			if (!canWrite)
				elem.SetAttribute ("canWrite", "false");
		}
Beispiel #16
0
    //
    //createDataElement
    //
    private static void createDataElement(
        ref System.Xml.XmlDocument pdoc,
        string pname, string pvalue,
        string pcomment)
    {
        System.Xml.XmlElement data = pdoc.CreateElement("data");
        data.SetAttribute("name", pname);
        data.SetAttribute("xml:space", "preserve");

        System.Xml.XmlElement value = pdoc.CreateElement("value");
        value.InnerText = pvalue;
        data.AppendChild(value);

        if (!(pcomment == null))
        {
            System.Xml.XmlElement comment = pdoc.CreateElement("comment");
            comment.InnerText = pcomment;
            data.AppendChild(comment);
        }

        System.Xml.XmlNode root     = pdoc.SelectSingleNode("//root");
        System.Xml.XmlNode old_data = root.SelectSingleNode("//data[@name='" + pname + "']");
        if (old_data == null)
        {
            root.AppendChild(data);
        }
        else
        {
            root.ReplaceChild(data, old_data);
        }
    }
Beispiel #17
0
        /// <summary>
        /// utility function to write the simple setParameter.xml file
        /// </summary>
        /// <param name="loggingHelper"></param>
        /// <param name="parameters"></param>
        /// <param name="outputFileName"></param>
        private static void WriteSetParametersToFile(Utilities.TaskLoggingHelper loggingHelper, Framework.ITaskItem[] parameters, string outputFileName, bool foptimisticParameterDefaultValue)
        {
            Xml.XmlDocument document          = new System.Xml.XmlDocument();
            Xml.XmlElement  parametersElement = document.CreateElement("parameters");
            document.AppendChild(parametersElement);
            if (parameters != null)
            {
                System.Collections.Generic.IList <Framework.ITaskItem> items
                    = Utility.SortParametersTaskItems(parameters, foptimisticParameterDefaultValue, SimpleSyncParameterMetadata.Value.ToString());

                // only the first value win
                System.Collections.Generic.Dictionary <string, Xml.XmlElement> dictionaryLookup
                    = new System.Collections.Generic.Dictionary <string, Xml.XmlElement>(parameters.GetLength(0));

                foreach (Framework.ITaskItem item in items)
                {
                    string name = item.ItemSpec;
                    if (!dictionaryLookup.ContainsKey(name))
                    {
                        Xml.XmlElement parameterElement = document.CreateElement("setParameter");
                        parameterElement.SetAttribute("name", name);
                        string value = item.GetMetadata("value");
                        parameterElement.SetAttribute("value", value);
                        dictionaryLookup.Add(name, parameterElement);
                        parametersElement.AppendChild(parameterElement);
                    }
                }
            }

            // Save the UTF8 and Indented
            Utility.SaveDocument(document, outputFileName, System.Text.Encoding.UTF8);
        }
        public static string updListaSDC(string lstSDC, string regs, string UserName, string Password)
        {
            ListsWebSrv.Lists listService = retListWebSrv(UserName, Password);
            //
            System.Xml.XmlNode ndListView = listService.GetListAndView(lstSDC, "");
            string             strListID  = ndListView.ChildNodes[0].Attributes["Name"].Value;
            string             strViewID  = ndListView.ChildNodes[1].Attributes["Name"].Value;

            //
            System.Xml.XmlDocument doc          = new System.Xml.XmlDocument();
            System.Xml.XmlElement  batchElement = doc.CreateElement("Batch");
            batchElement.SetAttribute("OnError", "Continue");
            batchElement.SetAttribute("ListVersion", "1");
            batchElement.SetAttribute("ViewName", strViewID);

            batchElement.InnerXml = regs; //"<Method ID='0' Cmd='New'><Field Name='Title'>Added item</Field></Method>";

            try
            {
                XmlNode nodeListItems = listService.UpdateListItems(strListID, batchElement);
                var     owsID         = nodeListItems.SelectSingleNode("//@ows_ID").Value;
                //
                return(owsID);
            }
            catch (Exception)
            {
                return("-1");
            }
        }
Beispiel #19
0
        public TraceToXML(Point beginPoint, String penColor, String penWidth)
        {
            this.beginPoint = beginPoint;
            //创建 XML 对象
            xmlDocument = new XmlDocument();
            //声明 XML
            xmlDeclare = xmlDocument.CreateXmlDeclaration("1.0", "utf-8", null);
            //创建根节点
            elementRoot = xmlDocument.CreateElement("Trace");
            xmlDocument.AppendChild(elementRoot);

            //创建第一个节点
            //创建节点 Section
            elementSection = xmlDocument.CreateElement("Section");
            elementSection.SetAttribute("penColor", penColor);
            elementSection.SetAttribute("penWidth", penWidth);
            elementRoot.AppendChild(elementSection);
            //创建 Section 的子节点 Point
            XmlElement elementPoint = xmlDocument.CreateElement("Point");
            elementPoint.SetAttribute("time", "0");
            XmlElement elementX = xmlDocument.CreateElement("X");
            elementX.InnerText = beginPoint.X.ToString();
            elementPoint.AppendChild(elementX);
            XmlElement elementY = xmlDocument.CreateElement("Y");
            elementY.InnerText = beginPoint.Y.ToString();
            elementPoint.AppendChild(elementY);
            elementSection.AppendChild(elementPoint);
        }
Beispiel #20
0
 void HandleAttributes(XmlElement gapi_elem)
 {
     bool needs_array = true;
     foreach (XmlAttribute attr in elem.Attributes) {
         switch (attr.Name) {
         case "c:type":
             gapi_elem.SetAttribute ("type", attr.Value);
             break;
         case "fixed-size":
             gapi_elem.SetAttribute ("array_len", attr.Value);
             break;
         case "length":
             gapi_elem.SetAttribute ("length_param", attr.Value);
             break;
         case "name":
             if (!elem.HasAttribute ("c:type"))
                 gapi_elem.SetAttribute ("type", SymbolTable.Lookup (attr.Value));
             needs_array = false;
             break;
         default:
             Console.WriteLine ("Unexpected attribute on array element: " + attr.Name);
             break;
         }
     }
     if (needs_array)
         gapi_elem.SetAttribute ("array", "1");
 }
Beispiel #21
0
		/// <summary>
		/// Salva definições em um xml
		/// </summary>
		public override void SaveXml(XmlDocument doc, XmlElement element)
		{
			base.SaveXml (doc, element);

			element.SetAttribute("prefixo", prefixo);
			element.SetAttribute("sufixo", sufixo);
		}
 public void StoryStarting(Story story)
 {
     _currentStoryElement = _doc.CreateElement(XmlNames.Story);
     _currentStoryElement.SetAttribute(XmlNames.Id, story.Id);
     _currentStoryElement.SetAttribute(XmlNames.Summary, story.Summary);
     SetStatus(_currentStoryElement, StatusNames.Success);
     _doc.DocumentElement.AppendChild(_currentStoryElement);
 }
Beispiel #23
0
        public Wix()
        {
            root = WXS.CreateElement("Wix");
            root.SetAttribute("xmlns", "http://schemas.microsoft.com/wix/2006/wi");
            root.SetAttribute("xmlns:util", "http://schemas.microsoft.com/wix/UtilExtension");

            Wix.WXS.AppendChild(root);
        }
 public void WriteToXml(XmlElement parent)
 {
   parent.SetAttribute("projectId", GetProject().GetPersistentID());
   parent.SetAttribute("typeName", TypeName.FullName);
   parent.SetAttribute("assemblyLocation", AssemblyLocation);
   parent.SetAttribute("isIgnored", Explicit.ToString());
   parent.SetAttribute("subject", _subject);
 }
 public override void SaveConditionToXml(ICondition condition, XmlElement conditionElement)
 {
     var c = (PomodoroTimeCondition)condition;
     conditionElement.SetAttribute("moreOrLess", c.More.ToString());
     conditionElement.SetAttribute("timeout", c.Timeout.ToString());
     conditionElement.SetAttribute("afterPomodoroStarted", c.AfterPomodoroStarted.ToString());
     conditionElement.SetAttribute("afterPomodoroCompleted", c.AfterPomodoroCompleted.ToString());
 }
        protected override void SaveReminderInternal(IReminder reminder, XmlElement reminderElement)
        {
            var apr = (AfterPomodoroReminder)reminder;

            reminderElement.SetAttribute("started", apr.Started.ToString());
            reminderElement.SetAttribute("rung", apr.Rung.ToString());
            reminderElement.SetAttribute("timeout", apr.Timeout.ToString());
        }
Beispiel #27
0
 public void UpdateGapiElement(XmlElement gapi_elem)
 {
     if (Converter.Default.Verbose)
         Validate ();
     gapi_elem.SetAttribute ("type", GetCType (elem));
     if (elem ["type"] != null)
         gapi_elem.SetAttribute ("element_type", GetCType (elem ["type"]));
 }
Beispiel #28
0
 public void addNewSection(String penColor, String penWidth)
 {
     //创建节点 Section
     elementSection = xmlDocument.CreateElement("Section");
     elementSection.SetAttribute("penColor", penColor);
     elementSection.SetAttribute("penWidth", penWidth);
     elementRoot.AppendChild(elementSection);
 }
Beispiel #29
0
 public void SerializeToXml(XmlElement node)
 {
     node.SetAttribute("ip", IPAddress);
     node.SetAttribute("vsix_version", VsixVersion);
     node.SetAttribute("vs_version", VSVersion);
     node.SetAttribute("machine_name", MachineName);
     node.SetAttribute("country", Country);
     node.SetAttribute("city", City);
 }
Beispiel #30
0
        internal override DownloadOptions.ExtractSaveResult Save(XmlElement oDatasetElement, string strDestFolder, DownloadSettings.DownloadCoordinateSystem eCS)
        {
            bool blFileExists;
            String strFilename = String.Empty;

            bool openANewMap;

            if (MainForm.MontajInterface.HostHasOpenMap())
            {
                string strSrcCoordinateSystem = m_strLayerProjection;
                if (string.IsNullOrEmpty(strSrcCoordinateSystem))
                    return ExtractSaveResult.Ignore;
                double dMinX, dMinY, dMaxX, dMaxY;
                if (!MainForm.MontajInterface.GetExtents(m_oDAPLayer.ServerURL, m_oDAPLayer.DatasetName, out dMaxX, out dMinX, out dMaxY, out dMinY))
                    return ExtractSaveResult.Ignore;

                openANewMap = !IntersectMap(ref dMinX, ref dMinY, ref dMaxX, ref dMaxY, strSrcCoordinateSystem);
            }
            else
            {
                openANewMap = true;
            }

            try
            {
                strFilename = m_oDAPLayer.LocalFilename;
                String strStrippedFilename = StripQualifiers(strFilename);

                blFileExists = File.Exists(strStrippedFilename);
            }
            catch (Exception)
            {
                blFileExists = false;
            }

            if (blFileExists)
            {
                oDatasetElement.SetAttribute("filename", strFilename);
                oDatasetElement.SetAttribute("type", m_oDAPLayer.DAPType);
                oDatasetElement.SetAttribute("id", m_oDAPLayer.DatasetName);
                oDatasetElement.SetAttribute("new_map", openANewMap.ToString());

                return ExtractSaveResult.Extract;
            }
            else
            {
                if (MessageBox.Show("The local file for dataset " + m_oDAPLayer.Title + " cannot be found. Ignore file and extract other datasets?", "Opening Local Dataset", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    return ExtractSaveResult.Ignore;
                }
                else
                {
                    return ExtractSaveResult.Cancel;
                }
            }
        }
Beispiel #31
0
 /// <summary>
 /// Добавить строку в файл настроек
 /// </summary>
 /// <param name="KeyName">Наименование настройки</param>
 /// <param name="KeyValue">Значение настройки</param>
 /// <returns>True - успешная запись в файл настроек</returns>
 private bool AddSettingToXml(string KeyName, string KeyValue)
 {
     System.Xml.XmlElement El = SettingsXmlDoc.CreateElement("SettingString");
     El.SetAttribute("KeyName", KeyName);
     El.SetAttribute("KeyValue", KeyValue);
     El.SetAttribute("UserName", Environment.UserName);
     SettingsXmlDoc.DocumentElement.AppendChild(El);
     SettingsXmlDoc.Save(_settingsXML);
     return(true);
 }
        private System.Xml.XmlElement RowToXml(int rowIndex)
        {
            string source = fpConditionSource_Sheet1.Cells[rowIndex, 0].Text;
            string name   = fpConditionSource_Sheet1.Cells[rowIndex, 1].Text;

            System.Xml.XmlElement node = Forms.frmQuickReportEditor.xmlDocument.CreateElement(XmlAttrDic.ConditionSourceObject.ToString());
            node.SetAttribute(XmlAttrDic.tConditionSource.ToString(), source);
            node.SetAttribute(XmlAttrDic.tCondtionName.ToString(), name);
            return(node);
        }
Beispiel #33
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet<int> processed)
 {
     base.SetXML(xml, host, processed);
     xml.SetAttribute("Eastings", mEastings.ToString());
     xml.SetAttribute("Northings", mNorthings.ToString());
     xml.SetAttribute("OrthogonalHeight", mOrthogonalHeight.ToString());
     setAttribute(xml, "XAxisAbscissa", mXAxisAbscissa);
     setAttribute(xml, "XAxisOrdinate", mXAxisOrdinate);
     setAttribute(xml, "Scale", mScale);
 }
		public void SetUpFixture()
		{
			XmlDocument doc = new XmlDocument();
			doc.LoadXml(GetWixXml());
			dialogElement = (XmlElement)doc.SelectSingleNode("//w:Dialog", new WixNamespaceManager(doc.NameTable));
			dialogElement.SetAttribute("Id", "id");
			dialogElement.SetAttribute("Title", "title");
			XmlElement controlElement = doc.CreateElement("Control", WixNamespaceManager.Namespace);
			dialogElement.AppendChild(controlElement);
		}
        /// <summary>
        /// Экспорт в Microsoft Excel.
        /// </summary>
        /// <param name="provider">Provider.</param>
        /// <returns>Возращает строку с xml в формате "Spreadsheet".</returns>
        static public string ExportToExcel(PivotDataProvider provider)
        {
            pivotDataProvider = provider;
            document = new XmlDocument();
            
            WriteHeaders();
            
            //<DocumentProperties>
            WriteDocumentProperties();
            
            //<Styles>
            WriteDefaultStyles();

            string cubeName = provider.Provider.CellSet_Description.CubeName;
            //<Worksheet>
            worksheet = document.CreateElement("s", "Worksheet", spreadsheetNamespace);
            worksheet.SetAttribute("Protected", spreadsheetNamespace, true.GetHashCode().ToString());
            worksheet.SetAttribute("Name", spreadsheetNamespace, cubeName);
            workbook.AppendChild(worksheet);

            //<Table>
            table = document.CreateElement("s", "Table", spreadsheetNamespace);
            table.SetAttribute("StyleID", spreadsheetNamespace, tableStyle);
            worksheet.AppendChild(table);

            //Количество строк в области колонок:
            int colRowsCount = 0;
            if(pivotDataProvider.Provider.CellSet_Description.Axes.Count > 0 &&
               pivotDataProvider.Provider.CellSet_Description.Axes[0].Positions.Count > 0)
            {
                colRowsCount = pivotDataProvider.Provider.CellSet_Description.Axes[0].Positions[0].Members.Count;
            }
            //количество колонок в области строк:
            int rowColumnsCount = 0;
            if (pivotDataProvider.Provider.CellSet_Description.Axes.Count > 1 &&
                pivotDataProvider.Provider.CellSet_Description.Axes[1].Positions.Count > 0)
            {
                rowColumnsCount = pivotDataProvider.Provider.CellSet_Description.Axes[1].Positions[0].Members.Count;
            }

            //количество колонок в области колонок:
            int colColumnsCount = pivotDataProvider.ColumnsArea.ColumnsCount;
            
            //Задать ширину колонок:
            SetColumnsWidth(rowColumnsCount, colColumnsCount);

            WriteFilters();
            WriteColumns(rowColumnsCount + 1);
            WriteRows(colColumnsCount);

            //<WorksheetOptions>
            SetWorksheetOptions();
            
            return document.OuterXml.Replace("amp;#", "#");
        }
        /// <summary>
        /// Initialises a new <see cref="XmlDocument"/> by adding required definitions to
        /// the structure indicated by its root <see cref="XmlElement"/>.
        /// </summary>
        /// <param name="release">The <see cref="SchemaRelease"/> being initialised.</param>
        /// <param name="root">The root <see cref="XmlElement"/> of the new document.</param>
        /// <param name="isDefaultNamespace"><b>true</b> if the default namespace is being initialised.</param>
        public override void Initialise(HandCoded.Meta.SchemaRelease release, XmlElement root, bool isDefaultNamespace)
        {
            base.Initialise (release, root, isDefaultNamespace);

            int majorVersion = Int32.Parse (release.Version.Split('-')[0]);

            if (majorVersion <= 4)
                root.SetAttribute ("version", release.Version);
            else
                root.SetAttribute("fpmlVersion", release.Version);
        }
        public AbstractXmlResponseBuilder(string rootElement, string version)
        {
            string versionCode = version.Replace('.', '_');
            pnmNamespace = "http://www.paynearme.com/api/pnm_xmlschema_v" + versionCode;

            Document = new XmlDocument();
            root = Document.CreateElement("t", rootElement, pnmNamespace);
            root.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            root.SetAttribute("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", "http://www.paynearme.com/api/pnm_xmlschema_" + versionCode + " pnm_xmlschema_" + versionCode + ".xsd");
            root.SetAttribute("version", version);
            Document.AppendChild(root);
        }
 protected override void WriteToXmlElement(XmlElement iElement)
 {
     base.WriteToXmlElement(iElement);
     if (!String.IsNullOrEmpty(OldName))
     {
         iElement.SetAttribute("oldname", OldName);
     }
     if (!String.IsNullOrEmpty(OldEnglish))
     {
         iElement.SetAttribute("oldenglish", OldEnglish);
     }
 }
Beispiel #39
0
        // ---------------------------------------------------------------------------------------------------
        // SetElementAttribute
        //
        // Sets the attributes of the XMLElement with name and type
        //
        // Param xmlDoc: The root XML document
        // Param propertyName: The name of the member
        // Param type: The member type
        // ---------------------------------------------------------------------------------------------------
        private static void SetElementAttribute(System.Xml.XmlElement xmlElement, string propertyName, Type type)
        {
            xmlElement.SetAttribute("name", propertyName);

            string sType = "xs:string";

            switch (type.Name)
            {
            case "Int32":
            case "Int64":
                sType = "xs:integer";
                break;

            case "Single":
                sType = "xs:float";
                break;

            case "Boolean":
                sType = "xs:boolean";
                break;

            case "Byte":
            case "SByte":
                sType = "xs:byte";
                break;

            case "Decimal":
                sType = "xs:decimal";
                break;

            case "Double":
                sType = "xs:double";
                break;

            case "UInt32":
                sType = "xs:unsignedInt";
                break;

            case "UInt64":
                sType = "xs:unsignedLong";
                break;

            case "Int16":
                sType = "xs:short";
                break;

            case "UInt16":
                sType = "xs:unsignedShort";
                break;
            }

            xmlElement.SetAttribute("type", sType);
        }
 protected override void WriteToXmlElement(XmlElement iElement)
 {
     base.WriteToXmlElement(iElement);
     if (Type != EntityType.Unknown)
     {
         iElement.SetAttribute("type", Type.ToString());
     }
     if (Parent != 0)
     {
         iElement.SetAttribute("parent", Parent.ToString());
     }
 }
Beispiel #41
0
    public static System.Xml.XmlElement CreateSaveElement(System.Xml.XmlElement parent, LLDNBase gnb)
    {
        System.Xml.XmlElement ret = parent.OwnerDocument.CreateElement("node");
        ret.SetAttribute("type", gnb.nodeType.ToString());
        ret.SetAttribute("id", gnb.GUID);
        ret.SetAttribute("x", gnb.cachedUILocation.x.ToString());
        ret.SetAttribute("y", gnb.cachedUILocation.y.ToString());
        parent.AppendChild(ret);

        gnb.SaveXML(ret);

        return(ret);
    }
Beispiel #42
0
        internal void SaveToXml(System.Xml.XmlElement xmlEl, System.Xml.XmlDocument doc)
        {
            xmlEl.SetAttribute("ORD", this.Ordinal.ToString());
            xmlEl.SetAttribute("SO", this.Order.ToString());
            xmlEl.SetAttribute("ETO", this.EmptyTupleOption.ToString());

            foreach (Hierarchy hier in this.Hierarchies)            //hierarchies
            {
                System.Xml.XmlElement childEl = doc.CreateElement("H");
                hier.SaveToXml(childEl, doc);
                xmlEl.AppendChild(childEl);
            }
        }
Beispiel #43
0
        /// <summary>
        /// 保存设置。
        /// </summary>
        /// <param name="KeyString">健名</param>
        /// <param name="KeyValue">值</param>
        /// <returns></returns>
        public bool SetConfigValue(string KeyString, object KeyValue)
        {
            //为配置文件定义一个FileInfo对象
            System.IO.FileInfo FileInfo = new System.IO.FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);

            //将配置文件读入XML DOM
            System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();

            xmlDocument.Load(FileInfo.FullName);

            //找到正确的节点并将它的值改为新的
            try
            {
                bool isModified = false;
                foreach (System.Collections.IEnumerable ie in xmlDocument.GetElementsByTagName("appSettings"))
                {
                    System.Xml.XmlNode node = ie as System.Xml.XmlNode;

                    foreach (System.Xml.XmlNode Node in node.ChildNodes)
                    {
                        if (Node.Name == "add")
                        {
                            if (Node.Attributes.GetNamedItem("key").Value == KeyString)
                            {
                                Node.Attributes.GetNamedItem("value").Value = KeyValue.ToString();
                                isModified = true;
                                break;
                            }
                        }
                    }
                    if (!isModified)
                    {
                        //添加一个结点
                        System.Xml.XmlElement xmlE = xmlDocument.CreateElement("add");
                        xmlE.SetAttribute("key", KeyString);
                        xmlE.SetAttribute("value", KeyValue.ToString());
                        xmlDocument.SelectSingleNode("//appSettings").AppendChild(xmlE);
                    }
                }
            }
            catch (Exception err)
            {
                throw new Exception("保存配置" + KeyString + "出错!", err);
            }

            //保存修改过的配置文件
            xmlDocument.Save(FileInfo.FullName);
            SetConfig();

            return(true);
        }
Beispiel #44
0
 protected void in1(System.Xml.XmlElement el, string text, string id, string sex)
 {
     el.SetAttribute("text", text.ToString());
     el.SetAttribute("id", id.ToString());
     if (sex == "false")
     {
         el.SetAttribute("im0", "file.gif");
     }
     else
     {
         el.SetAttribute("im0", "file.gif");
     }
     el.SetAttribute("child", "0");
 }
Beispiel #45
0
        public override bool ToXML(System.Xml.XmlElement myElement)
        {
            if (myElement != null)
            {
                this.Attributes.ToXML(myElement);
                myElement.SetAttribute("type", StringCommon.GetNameByType(this.Type));
                myElement.SetAttribute("name", this.Name);

                myElement.InnerText = this.Text;
                return(true);
                //return base.ToXML(myElement);
            }
            return(false);
        }
Beispiel #46
0
 protected override void OnSaveToXml(System.Xml.XmlDocument vDoc, System.Xml.XmlElement vNode)
 {
     base.OnSaveToXml(vDoc, vNode);
     vNode.SetAttribute("aiRefid", mocReference_.aiRefid.ToString());
     vNode.SetAttribute("patrolType", mocReference_.patrolType);
     vNode.SetAttribute("teamID", mocReference_.teamID.ToString());
     for (int i = 0; i < routeList_.Count; i++)
     {
         XmlElement routeEle = vDoc.CreateElement("Route");
         routeEle.SetAttribute("position", GameUtility.VectorToStr(routeList_[i].position));
         routeEle.SetAttribute("stoptime", routeList_[i].stopTime.ToString());
         vNode.AppendChild(routeEle);
     }
 }
Beispiel #47
0
 public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters)
 {
     if (!string.IsNullOrEmpty(this.RegistryHive))
     {
         element.SetAttribute(RegistryHiveAttributeName, this.RegistryHive);
     }
     if (!string.IsNullOrEmpty(this.AdditionalCommandLineArguments))
     {
         element.SetAttribute(AdditionalCommandLineArgumentsAttributeName, this.AdditionalCommandLineArguments);
     }
     if (!string.IsNullOrEmpty(this.AdditionalTestData))
     {
         element.SetAttribute(AdditionalTestDataAttributeName, this.AdditionalTestData);
     }
 }
Beispiel #48
0
    public virtual bool SaveXML(System.Xml.XmlElement ele)
    {
        foreach (ParamBase pb in this.genParams)
        {
            string paramType = ParamBase.ToSerializationType(pb.type);
            System.Xml.XmlElement paramEle = ele.OwnerDocument.CreateElement(paramType);
            paramEle.SetAttribute("name", pb.name);
            paramEle.InnerText = pb.GetStringValue();
            paramEle.SetAttribute("visible", ParamBool.ConvertToString(pb.visible));

            ele.AppendChild(paramEle);
        }

        return(true);
    }
Beispiel #49
0
 public static void SetColor(Color color, string nodeName, System.Xml.XmlElement node)
 {
     if (color.A == 255)
     {
         node.SetAttribute(nodeName, ColorTranslator.ToHtml(color));
     }
     else
     {
         string str = String.Format("#{0}{1}{2}{3}",
                                    color.A.ToString("X2"),
                                    color.R.ToString("X2"),
                                    color.G.ToString("X2"),
                                    color.B.ToString("X2"));
         node.SetAttribute(nodeName, str);
     }
 }
Beispiel #50
0
        private XmlNode DomainObjectToXmlNode(Type type, object[] objs, string[] schema)
        {
            XmlDocument doc = new XmlDocument();

            System.Xml.XmlElement rootElement = doc.CreateElement("xml");
            rootElement.SetAttribute("xmlns:s", "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");
            rootElement.SetAttribute("xmlns:dt", "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882");
            rootElement.SetAttribute("xmlns:rs", "urn:schemas-microsoft-com:rowset");
            rootElement.SetAttribute("xmlns:z", "#RowsetSchema");

            rootElement.AppendChild(DomainObjectSchemaToXml(doc, type, schema));

            rootElement.AppendChild(DomainObjectDataToXml(doc, objs, schema));

            return(rootElement);
        }
Beispiel #51
0
        void AddPatchInfo(string patchinfofilename, string nodename, string filestring)
        {
            if (filestring == null)
            {
                return;
            }

            string [] filenames = filestring.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            if (System.IO.File.Exists(patchinfofilename))
            {
                System.Xml.XmlDocument xml = new XmlDocument();
                xml.Load(patchinfofilename);

                System.Xml.XmlNode patchinfo = xml.SelectSingleNode("Patchinfo");

                System.Xml.XmlElement node = (System.Xml.XmlElement)patchinfo.SelectSingleNode(nodename);
                if (node == null)
                {
                    node = xml.CreateElement(nodename);
                    patchinfo.AppendChild(node);
                }

                foreach (string name in filenames)
                {
                    System.Xml.XmlElement file = xml.CreateElement("File");
                    file.SetAttribute("Name", name);
                    node.AppendChild(file);
                }

                xml.Save(patchinfofilename);
            }
        }
Beispiel #52
0
 public void SaveRuleList(List <RewriterRule> ruleList)
 {
     System.Xml.XmlDocument    xml = new System.Xml.XmlDocument();
     System.Xml.XmlDeclaration xmldecl;
     xmldecl = xml.CreateXmlDeclaration("1.0", "utf-8", null);
     xml.AppendChild(xmldecl);
     System.Xml.XmlElement xmlelem = xml.CreateElement("", "rewrite", "");
     foreach (RewriterRule rule in ruleList)
     {
         System.Xml.XmlElement e = xml.CreateElement("", "item", "");
         e.SetAttribute("lookfor", rule.LookFor);
         e.SetAttribute("sendto", rule.SendTo);
         xmlelem.AppendChild(e);
     }
     xml.AppendChild(xmlelem);
     xml.Save(HttpContext.Current.Server.MapPath(string.Format("//config/rewrite.config", "/")));
 }
    void saveOptions()
    {
        Xml.XmlNodeList optionNodes = xmlResult.GetElementsByTagName("Option");
        foreach (Xml.XmlElement nodes in optionNodes)
        {
            string attributeName = nodes.GetAttribute("optionName");

            switch (attributeName)
            {
            case "SoundVolume":
                nodes.SetAttribute("value", SoundManager.Get().sfxVolume.ToString());
                break;

            case "MusicVolume":
                nodes.SetAttribute("value", SoundManager.Get().musicVolume.ToString());
                break;

            case "SoundIsOn":
                nodes.SetAttribute("value", (!SoundManager.Get().muteSfx).ToString());
                break;

            case "MusicIsOn":
                nodes.SetAttribute("value", (!SoundManager.Get().muteMusic).ToString());
                break;
            }
        }

        // save the server settings
        Xml.XmlElement sevInfo = xmlResult.GetElementsByTagName("ServerInfo")[0] as Xml.XmlElement;
        sevInfo.SetAttribute("playername", nvs.myInfo.name);
        sevInfo.SetAttribute("hostname", nvs.serverName);
        sevInfo.SetAttribute("NATmode", nvs.NATmode.ToString());
        //putting a / after the * here breaks MonoDevelop's tab system - stupid piece of

        /*xmlResult.GetElementById("sih").GetAttribute("
         * Xml.XmlNodeList serverInfo = xmlResult.GetElementsByTagName ("ServerInfo");
         * foreach (Xml.XmlElement node in serverInfo)
         * {
         *      //should only be 1 node so loops fine - also I couldn't find a way to convert between XmlNode and XmlElement
         *      // save player name
         *      node.SetAttribute("playername", nvs.myInfo.name);
         *      // save server name
         *      node.SetAttribute("hostname", nvs.serverName);
         * }*/
    }
Beispiel #54
0
        public void WriteDirectoryXMLFile(string folder, string fnaam)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            GlobalDataStore.Logger.Debug("Updating " + fnaam + " ...");
            List <LabelX.Toolbox.LabelXItem> items = new List <LabelX.Toolbox.LabelXItem>();
            DirectoryInfo FolderDirectoryInfo      = new DirectoryInfo(folder);

            LabelX.Toolbox.Toolbox.GetFilesFromFolderTree(FolderDirectoryInfo.FullName, ref items);

            //items = alle ingelezen bestanden. Nu gaan wegschrijven.
            System.Xml.XmlDocument doc  = new System.Xml.XmlDocument();
            System.Xml.XmlElement  root = doc.CreateElement("LabelXItems");

            foreach (LabelX.Toolbox.LabelXItem item in items)
            {
                if (getFileExt(item.Name) == ".xml")
                {
                    continue;
                }

                System.Xml.XmlElement itemXML = doc.CreateElement("item");
                itemXML.SetAttribute("name", item.Name);
                itemXML.SetAttribute("hash", item.Hash);

                root.AppendChild(itemXML);
            }

            doc.AppendChild(root);

            MemoryStream ms = new MemoryStream();

            System.Xml.XmlTextWriter tw = new System.Xml.XmlTextWriter(ms, Encoding.UTF8)
            {
                Formatting = System.Xml.Formatting.Indented
            };
            doc.WriteContentTo(tw);
            doc.Save(folder + fnaam);
            tw.Close();

            sw.Stop();
            GlobalDataStore.Logger.Debug("Creating the XML Hash file for the directory took: " + sw.ElapsedMilliseconds + " ms (" + folder + ")");
            sw.Reset();
        }
Beispiel #55
0
    public System.Xml.XmlElement SaveXML(System.Xml.XmlDocument xmlDoc)
    {
        System.Xml.XmlElement wdDoc = xmlDoc.CreateElement(xmlName);
        wdDoc.SetAttribute("name", this.name);
        wdDoc.SetAttribute("id", this.guid);
        wdDoc.SetAttribute("cat", this.GetCategoryName());

        if (this.output != null)
        {
            wdDoc.SetAttribute("output", this.output.GUID);
        }

        foreach (LLDNBase gnb in this.generators)
        {
            LLDNBase.CreateSaveElement(wdDoc, gnb);
        }

        return(wdDoc);
    }
Beispiel #56
0
        private void createTypeElement(ref System.Xml.XmlDocument pdoc, string pid, string pname, string pcore, System.Collections.Generic.Dictionary <int, ContenttypeColumn> pfieldstable)
        {
            System.Xml.XmlElement contenttype = pdoc.CreateElement("", "ContentType", ns);
            contenttype.SetAttribute("ID", pid);
            contenttype.SetAttribute("Name", pname);
            contenttype.SetAttribute("Group", "$Resources:" + pcore + ",TypesGroupName;");
            contenttype.SetAttribute("Description", "$Resources:" + pcore + "," + pname + ";");
            contenttype.SetAttribute("Version", "0");

            System.Xml.XmlElement fieldrefs = pdoc.CreateElement("", "FieldRefs", ns);
            contenttype.AppendChild(fieldrefs);

            System.Collections.Generic.SortedDictionary <string, ContenttypeColumn> scol = new System.Collections.Generic.SortedDictionary <string, ContenttypeColumn>();
            foreach (ContenttypeColumn col in pfieldstable.Values)
            {
                scol.Add(col.Seqnr, col);
            }

            foreach (ContenttypeColumn col in scol.Values)
            {
                if (!col.SysCol)
                {
                    System.Xml.XmlElement fieldref = pdoc.CreateElement("", "FieldRef", ns);
                    fieldref.SetAttribute("ID", col.colGUID);
                    fieldref.SetAttribute("Name", col.SysName);
                    fieldrefs.AppendChild(fieldref);
                }
            }

            System.Xml.XmlNode elements = pdoc.SelectSingleNode("//mha:Elements", nsMgr);
            string             filter   = "//mha:ContentType[@ID=\"" + pid + "\"]";

            System.Xml.XmlNode old_contenttype = elements.SelectSingleNode(filter, nsMgr);

            if (old_contenttype == null)
            {
                elements.AppendChild(contenttype);
            }
            else
            {
                elements.ReplaceChild(contenttype, old_contenttype);
            }
        }
        public void Add(string Key, string Value)
        {
            // Load the config file into the XML DOM.
            XmlDocument xmlDom = GetXmlDocument();

            // create a new node
            System.Xml.XmlElement elem = xmlDom.CreateElement("add");
            elem.SetAttribute("key", Key);
            elem.SetAttribute("value", Value);

            // add the node to the section
            System.Xml.XmlNode node = xmlDom.SelectSingleNode("configuration/" + m_Section);
            node.AppendChild(elem);

            // Save the modified config file.
            xmlDom.Save(m_ConfigFile);

            m_Settings.Add(Key, Value);

            return;
        }
Beispiel #58
0
        private XmlNode DomainObjectDataToXml(XmlDocument doc, object obj, string[] schema)
        {
            System.Xml.XmlElement element = doc.CreateElement("z", "row", "#RowsetSchema");

            object value = null;

            foreach (string memberName in schema)
            {
                value = DomainObjectUtility.GetValue(obj, memberName, null);

                if (value == null)
                {
                    element.SetAttribute(memberName, string.Empty.PadRight(40, ' '));
                }
                else
                {
                    element.SetAttribute(memberName, DomainObjectUtility.XMLEncodeValue(value.GetType(), value).PadRight(40, ' '));
                }
            }

            return(element);
        }
Beispiel #59
0
        // ---------------------------------------------------------------------------------------------------
        // CreateAnnotationElement
        //
        // An annotation element is the relation of two classes
        //
        // Param xmlDoc: The root XML document
        // Param parent: The parent "table"
        // Param returnType: The child "table"
        // ---------------------------------------------------------------------------------------------------
        private static System.Xml.XmlElement CreateAnnotationElement(XmlDocument xmlDoc, string parent, string child)
        {
            if (parent == child)
            {
                return(null);
            }

            System.Xml.XmlElement AnnotationElement = xmlDoc.CreateElement("xs", "annotation", "http://www.w3.org/2001/XMLSchema");
            System.Xml.XmlElement appinfoElement    = xmlDoc.CreateElement("xs", "appinfo", "http://www.w3.org/2001/XMLSchema");

            System.Xml.XmlElement RelationshipElement = xmlDoc.CreateElement("msdata", "Relationship", "urn:schemas-microsoft-com:xml-msdata");
            RelationshipElement.SetAttribute("name", parent + "_" + child);
            RelationshipElement.SetAttribute("parent", "urn:schemas-microsoft-com:xml-msdata", parent);
            RelationshipElement.SetAttribute("child", "urn:schemas-microsoft-com:xml-msdata", child);
            RelationshipElement.SetAttribute("parentkey", "urn:schemas-microsoft-com:xml-msdata", "TXID_" + parent);
            RelationshipElement.SetAttribute("childkey", "urn:schemas-microsoft-com:xml-msdata", "TXID_" + child);

            appinfoElement.AppendChild(RelationshipElement);
            AnnotationElement.AppendChild(appinfoElement);

            return(AnnotationElement);
        }
        public static int SubmitReintegro(Reintegro newReintegro)
        {
            /*Get Name attribute values (GUIDs) for list and view. */
            System.Xml.XmlNode ndList    = listService.GetListAndView(listName, "");
            string             strListID = ndList.ChildNodes[0].Attributes["Name"].Value;
            string             strViewID = ndList.ChildNodes[1].Attributes["Name"].Value;

            /*Create an XmlDocument object and construct a Batch element and its
             * attributes. Note that an empty ViewName parameter causes the method to use the default view. */
            System.Xml.XmlDocument doc          = new System.Xml.XmlDocument();
            System.Xml.XmlElement  batchElement = doc.CreateElement("Batch");
            batchElement.SetAttribute("OnError", "Continue");
            batchElement.SetAttribute("ListVersion", "1");
            batchElement.SetAttribute("ViewName", strViewID);


            /*Specify methods for the batch post using CAML. To update or delete,
             * specify the ID of the item, and to update or add, specify
             * the value to place in the specified column.*/
            batchElement.InnerXml =
                "<Method ID='1' Cmd='New'>" +
                "<Field Name='Title'>" + newReintegro.Title + "</Field>" +
                "<Field Name='Persona'>" + newReintegro.Persona + "</Field>" +
                "<Field Name='Subunidad'>" + newReintegro.Subunidad + "</Field>" +
                "<Field Name='Proyecto_x002e_Subproyecto_x002e'>" + newReintegro.Subproyecto + "</Field>" +
                "<Field Name='Motivo_x0020_de_x0020_Solicitud'>" + newReintegro.Motivo + "</Field>" +
                "<Field Name='Importe'>" + newReintegro.Importe + "</Field>" +
                "<Field Name='Fecha'>" + newReintegro.Fecha + "</Field>" +
                "<Field Name='Cliente_x002f_Proyecto'>" + newReintegro.ClienteProyecto + "</Field>" +
                "<Field Name='Debe_x0020_Autorizar'>" + newReintegro.DebeAutorizar + "</Field>" +
                "<Field Name='Persona_x0020_Autorizante'>" + newReintegro.PersonaAutorizante + "</Field>" +
                "</Method>";

            /*Update list items. This example uses the list GUID, which is recommended,
             * but the list display name will also work.*/
            XmlNode insertedNode = listService.UpdateListItems(strListID, batchElement);

            return(XmlHelper.GetResultID(insertedNode));
        }