当前位置: 首页>>代码示例>>C#>>正文


C# XmlWriter.WriteStartAttribute方法代码示例

本文整理汇总了C#中System.Xml.XmlWriter.WriteStartAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteStartAttribute方法的具体用法?C# XmlWriter.WriteStartAttribute怎么用?C# XmlWriter.WriteStartAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlWriter的用法示例。


在下文中一共展示了XmlWriter.WriteStartAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SerializeNetwork

        public override void SerializeNetwork(XmlWriter xmlWriter)
        {
            base.SerializeNetwork(xmlWriter);

            var expander = ControlElements[0] as SliderExpanderDouble;
            if (expander == null) return;

            xmlWriter.WriteStartAttribute("SliderMax");
            xmlWriter.WriteValue(expander.SliderMax);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("SliderMin");
            xmlWriter.WriteValue(expander.SliderMin);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("SliderValue");
            xmlWriter.WriteValue(expander.SliderValue);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("SliderStep");
            xmlWriter.WriteValue(expander.SliderStep);
            xmlWriter.WriteEndAttribute();

            xmlWriter.WriteStartAttribute("IsExpanded");
            xmlWriter.WriteValue(expander.IsExpanded);
            xmlWriter.WriteEndAttribute();
        }
开发者ID:aquarius20th,项目名称:CSharp_TUM.CMS.VPLControl,代码行数:27,代码来源:DoubleSlider.cs

示例2: GetDirectoryItemsWithXmlWriter

        static void GetDirectoryItemsWithXmlWriter(string path, XmlWriter writer)
        {
            var dirInfo = new DirectoryInfo(path);

            var files = dirInfo.GetFiles();
            var subdirs = dirInfo.GetDirectories();

            writer.WriteStartElement("dir");
            writer.WriteStartAttribute("name");
            writer.WriteValue(dirInfo.Name);
            writer.WriteEndAttribute();

            foreach (var file in files)
            {
                writer.WriteStartElement("file");
                writer.WriteStartAttribute("name");
                writer.WriteValue(file.Name);
                writer.WriteEndAttribute();
                writer.WriteEndElement();
            }

            foreach (var dir in subdirs)
            {
                GetDirectoryItemsWithXmlWriter(dir.FullName, writer);
            }

            writer.WriteEndElement();
        }
开发者ID:VladimirDimov,项目名称:DataBases_HW,代码行数:28,代码来源:Program.cs

示例3: WriteDirectoryInfo

        private static void WriteDirectoryInfo(string directories, XmlWriter writer)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(directories);

            FileInfo[] files = directoryInfo.GetFiles();
            DirectoryInfo[] subDirectories = directoryInfo.GetDirectories();

            writer.WriteStartElement("Dir");
            writer.WriteStartAttribute("name");
            writer.WriteValue(directoryInfo.Name);
            writer.WriteEndAttribute();

            foreach (var file in files)
            {
                writer.WriteStartElement("File");
                writer.WriteStartAttribute("name");
                writer.WriteValue(file.Name);
                writer.WriteEndAttribute();
                writer.WriteEndElement();
            }

            foreach (var dir in subDirectories)
            {
                WriteDirectoryInfo(dir.FullName, writer);
            }

            writer.WriteEndElement();
        }
开发者ID:MarinMarinov,项目名称:Databases,代码行数:28,代码来源:Program.cs

示例4: InsertNode

        private void InsertNode(XmlWriter writer, Item item) {
            if (item.IsNamespaced) {
                writer.WriteStartElement(item.LocalName, item.Namespace);
            } else {
                writer.WriteStartElement(item.LocalName);
            }

            foreach (Item.AttributeNode attr in item.Attributes) {
                if (attr.IsNamespaced) {
                    writer.WriteStartAttribute(attr.LocalName, attr.Namespace);
                    writer.WriteAttributeString(attr.LocalName, attr.Namespace, attr.Value);
                } else {
                    writer.WriteStartAttribute(attr.LocalName);
                    writer.WriteAttributeString(attr.LocalName, attr.Value);
                }
                writer.WriteEndAttribute();
            }

            if (item.HasContent) {
                if (item.IsNamespaced) {
                    writer.WriteElementString(item.LocalName, item.Namespace, item.LocalValue.ToString());
                } else {
                    writer.WriteElementString(item.LocalName, item.LocalValue.ToString());
                }
            }

            if (item.HasChildren) {
                foreach (Item child in item.Children) {
                    InsertNode(writer, child);
                }
            }
            writer.WriteEndElement();
        }
开发者ID:rs22,项目名称:windows-phone,代码行数:33,代码来源:DAVRequestBody.cs

示例5: Write

        public void Write()
        {
            XmlWriterSettings xmlSetting = new XmlWriterSettings();
            xmlSetting.CloseOutput = true;
            xmlSetting.Encoding = Encoding.UTF8;
            xmlSetting.Indent = true;
            xmlSetting.NewLineChars = "\r\n";

            wr = XmlWriter.Create(GeneralConfig.AppDataPath + "Questionaries\\" + questionary.Category + ".xml", xmlSetting);
            wr.WriteStartDocument();
            wr.WriteStartElement("Questionary");
            wr.WriteStartAttribute("category");
            wr.WriteValue(questionary.Category);
            wr.WriteEndAttribute();

            wr.WriteStartAttribute("created");
            wr.WriteValue(questionary.Created.ToString());
            wr.WriteEndAttribute();

            wr.WriteStartAttribute("updated");
            wr.WriteValue(questionary.Updated.ToString());
            wr.WriteEndAttribute();

            wr.WriteStartAttribute("template");
            wr.WriteValue(questionary.TemplateId);
            wr.WriteEndAttribute();

            wr.WriteStartElement("Questions");
            WriteQuestions();
            wr.WriteEndElement();

            wr.WriteEndElement();
            wr.WriteEndDocument();
            wr.Close();
        }
开发者ID:foresightbrand,项目名称:kebibi,代码行数:35,代码来源:QuestionaryWriter.cs

示例6: WriteXMLToAttributes

		public void WriteXMLToAttributes(XmlWriter writer)
		{
			writer.WriteStartAttribute("lat");
			writer.WriteValue(this.lat.ToString(CultureInfo.InvariantCulture));
			writer.WriteEndAttribute();
			writer.WriteStartAttribute("lon");
			writer.WriteValue(this.lon.ToString(CultureInfo.InvariantCulture));
			writer.WriteEndAttribute();
		}
开发者ID:chharam,项目名称:Capstone_IPM_RV,代码行数:9,代码来源:LatLon.cs

示例7: WriteKey

 static void WriteKey(XmlWriter handle, string keyName, string keyValue)
 {
     handle.WriteStartElement("Key");
     handle.WriteStartAttribute("Name");
     handle.WriteValue(keyName);
     handle.WriteEndAttribute();
     handle.WriteStartAttribute("Value");
     handle.WriteValue(keyValue);
     handle.WriteEndAttribute();
     handle.WriteEndElement();
 }
开发者ID:SObS,项目名称:AssetCompiler,代码行数:11,代码来源:AssetCompiler.cs

示例8: writeColumnMapping

        private static void writeColumnMapping(XmlWriter writer, ColumnMapping columnMapping)
        {
            writer.WriteStartElement("ColumnMapping");

            writer.WriteStartAttribute("type");
            writer.WriteValue(columnMapping.GetType().Name);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("columnUse");
            writer.WriteValue(columnMapping.ColumnUse.ToString());
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("destinationColumnReference");
            writer.WriteValue(columnMapping.DestinationColumn.Name);
            writer.WriteEndAttribute();

            if (columnMapping is ExcelColumnMapping)
            {
                var excelColumnMapping = (ExcelColumnMapping)columnMapping;

                writer.WriteStartAttribute("sourceHeader");
                writer.WriteValue(excelColumnMapping.SourceHeader);
                writer.WriteEndAttribute();

            }
            else if (columnMapping is TableColumnMapping)
            {
                var tableColumnMapping = (TableColumnMapping)columnMapping;

                writer.WriteStartAttribute("sourceTableMappingIndex");
                writer.WriteValue(tableColumnMapping.SourceTableMapping.Index);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute("sourceColumnReference");
                writer.WriteValue(tableColumnMapping.SourceColumn.Name);
                writer.WriteEndAttribute();
            }
            else if (columnMapping is LiteralColumnMapping)
            {
                var literalColumnMapping = (LiteralColumnMapping)columnMapping;

                writer.WriteStartAttribute("literal");
                writer.WriteValue(literalColumnMapping.Literal);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute("literalType");
                writer.WriteValue(literalColumnMapping.LiteralType.ToString());
                writer.WriteEndAttribute();
            }

            writer.WriteEndElement();
            writer.WriteRaw("\n");
        }
开发者ID:RolfDyrberg,项目名称:SQLDataImporter,代码行数:53,代码来源:ConfigurationSaver.cs

示例9: WriteLayout

        private void WriteLayout(XmlWriter writer)
        {
            writer.WriteStartElement("Layout");

            for (int i = 0; i < map.TileLayers.Count; i++)
            {
                writer.WriteStartElement("Layer");

                writer.WriteStartAttribute("ID");
                writer.WriteValue(i);
                writer.WriteEndAttribute();

                WriteRows(writer, map.TileLayers[i]);

                writer.WriteEndElement();
            }

            writer.WriteStartElement("CustomLayer");

            WriteRows(writer, map.CustomLayer);

            writer.WriteEndElement();

            writer.WriteEndElement();
        }
开发者ID:elefantstudio-se,项目名称:tiny-tile-editor,代码行数:25,代码来源:MapWriter.cs

示例10: WriteTypeAttributes

 public static void WriteTypeAttributes(XmlWriter xmlWriter, object objectWithType)
 {
     string FullyQualifiedName = objectWithType.GetType().AssemblyQualifiedName;
     Regex RemoveExtraCrapSearch = new Regex(", (Version|Culture|PublicKeyToken)=[^,\\]]+");
     string LessQualifiedName = RemoveExtraCrapSearch.Replace(FullyQualifiedName, "");
     xmlWriter.WriteStartAttribute("Type");
     xmlWriter.WriteValue(LessQualifiedName);
 }
开发者ID:jeske,项目名称:agg-sharp,代码行数:8,代码来源:GameDataAttribute.cs

示例11: OnSave

        public virtual void OnSave(XmlWriter writer)
        {
            Vector3 pos = Transformation.GetPosition();
            Vector3 rot = Transformation.GetRotation();
            Vector3 scale = Transformation.GetScale();
            writer.WriteStartAttribute("position");
            writer.WriteValue(ParseUtils.WriteVector3(pos));
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("rotation");
            writer.WriteValue(ParseUtils.WriteVector3(rot));
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("scale");
            writer.WriteValue(ParseUtils.WriteVector3(scale));
            writer.WriteEndAttribute();
        }
开发者ID:MattVitelli,项目名称:IslandAdventure,代码行数:17,代码来源:Entity.cs

示例12: SerializeNetwork

        public override void SerializeNetwork(XmlWriter xmlWriter)
        {
            base.SerializeNetwork(xmlWriter);

            xmlWriter.WriteStartAttribute("InputPortsCount");
            xmlWriter.WriteValue(InputPorts.Count);
            xmlWriter.WriteEndAttribute();
        }
开发者ID:bsudhakarGit,项目名称:TUM.CMS.VPLControl,代码行数:8,代码来源:ListNode.cs

示例13: WriteAttribute

 public static void WriteAttribute(XmlWriter xmlWriter, string name, object value)
 {
     if (value != null)
     {
         xmlWriter.WriteStartAttribute(name);
         xmlWriter.WriteValue(value);
         xmlWriter.WriteEndAttribute();
     }
 }
开发者ID:CreatorDev,项目名称:DeviceServer,代码行数:9,代码来源:XmlHelper.cs

示例14: WriteXmlAttributes

        protected internal override void WriteXmlAttributes(XmlWriter writer)
        {
            if (!string.IsNullOrEmpty(StartMeasure))
            {
                writer.WriteStartAttribute(StartMeasureField);
                writer.WriteValue(StartMeasure);
                writer.WriteEndAttribute();
            }

            if (!string.IsNullOrEmpty(EndMeasure))
            {
                writer.WriteStartAttribute(EndMeasureField);
                writer.WriteValue(EndMeasure);
                writer.WriteEndAttribute();
            }

            base.WriteXmlAttributes(writer);
        }
开发者ID:netgrim,项目名称:MapKit,代码行数:18,代码来源:LinearCalibration.cs

示例15: SerializeNetwork

        public override void SerializeNetwork(XmlWriter xmlWriter)
        {
            base.SerializeNetwork(xmlWriter);

            var textBox = ControlElements[0] as TextBox;
            if (textBox != null)
            {
                xmlWriter.WriteStartAttribute("Text");
                xmlWriter.WriteValue(textBox.Text);
                xmlWriter.WriteEndAttribute();
            }

            var checkBox = ControlElements[2] as CheckBox;
            if (checkBox != null)
            {
                xmlWriter.WriteStartAttribute("CheckBoxIsChecked");
                if (checkBox.IsChecked != null) xmlWriter.WriteValue(checkBox.IsChecked);
                xmlWriter.WriteEndAttribute();
            }

            var comboBox = ControlElements[3] as ComboBox;
            if (comboBox != null)
            {
                xmlWriter.WriteStartAttribute("SelectedIndex");
                xmlWriter.WriteValue(comboBox.SelectedIndex);
                xmlWriter.WriteEndAttribute();
            }

            var slider = ControlElements[4] as Slider;
            if (slider != null)
            {
                xmlWriter.WriteStartAttribute("SliderMax");
                xmlWriter.WriteValue(slider.Maximum);
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("SliderMin");
                xmlWriter.WriteValue(slider.Minimum);
                xmlWriter.WriteEndAttribute();

                xmlWriter.WriteStartAttribute("SliderValue");
                xmlWriter.WriteValue(slider.Value);
                xmlWriter.WriteEndAttribute();
            }
        }
开发者ID:aquarius20th,项目名称:CSharp_TUM.CMS.VPLControl,代码行数:44,代码来源:TestNode.cs


注:本文中的System.Xml.XmlWriter.WriteStartAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。