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


C# XmlWriter.WriteValue方法代码示例

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


在下文中一共展示了XmlWriter.WriteValue方法的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: 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

示例4: 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

示例5: 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

示例6: WriteXml

 public override void WriteXml(XmlWriter writer)
 {
     writer.WriteStartElement("X");
     writer.WriteValue(((Point)Value).X);
     writer.WriteEndElement();
     writer.WriteStartElement("Y");
     writer.WriteValue(((Point)Value).Y);
     writer.WriteEndElement();
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:9,代码来源:PointProperty.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: WriteXml

 public void WriteXml(XmlWriter writer)
 {
    if (_value is DateTime)
    {
       writer.WriteValue(XmlConvert.ToString((DateTime)_value, DateSerializationFormat));  
    }
    else
    {            
       writer.WriteValue(XmlConvert.ToString((TimeSpan)_value));  
    }         
 }
开发者ID:SzymonPobiega,项目名称:WS-Man.Net,代码行数:11,代码来源:Expires.cs

示例9: AddEntry

        private void AddEntry(XmlWriter writer, Package package, string baseUrl)
        {
            writer.WriteStartElement("entry");

            writer.WriteElementString("id", package.ID);

            writer.WriteStartElement("title");
            writer.WriteAttributeString("type", "text");
            writer.WriteValue(package.Name);
            writer.WriteEndElement(); // title

            writer.WriteStartElement("link");
            writer.WriteAttributeString("rel", "alternate");
            writer.WriteAttributeString("href", baseUrl + "/extensions/" + package.ID + "/extension.vsix");
            writer.WriteEndElement(); // link

            writer.WriteStartElement("summary");
            writer.WriteAttributeString("type", "text");
            writer.WriteValue(package.Description);
            writer.WriteEndElement(); // summary

            writer.WriteElementString("published", package.DatePublished.ToString("yyyy-MM-ddTHH:mm:ssZ"));
            writer.WriteElementString("updated", package.DatePublished.ToString("yyyy-MM-ddTHH:mm:ssZ"));

            writer.WriteStartElement("author");
            writer.WriteElementString("name", package.Author);
            writer.WriteEndElement(); // author

            writer.WriteStartElement("content");
            writer.WriteAttributeString("type", "application/octet-stream");
            writer.WriteAttributeString("src", baseUrl + "/extensions/" + package.ID + "/extension.vsix");
            writer.WriteEndElement(); // content

            writer.WriteStartElement("link");
            writer.WriteAttributeString("rel", "icon");
            writer.WriteAttributeString("href", baseUrl + "/extensions/" + package.ID + "/" + package.Icon);
            writer.WriteEndElement(); // icon

            writer.WriteStartElement("link");
            writer.WriteAttributeString("rel", "previewimage");
            writer.WriteAttributeString("href", baseUrl + "/extensions/" + package.ID + "/" + package.Preview);
            writer.WriteEndElement(); // preview

            writer.WriteRaw("\r\n<Vsix xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://schemas.microsoft.com/developer/vsx-syndication-schema/2010\">\r\n");

            writer.WriteElementString("Id", package.ID);
            writer.WriteElementString("Version", package.Version);

            writer.WriteStartElement("References");
            writer.WriteEndElement();

            writer.WriteRaw("</Vsix>");// Vsix
            writer.WriteEndElement(); // entry
        }
开发者ID:flcdrg,项目名称:ExtensionGallery,代码行数:54,代码来源:FeedWriter.cs

示例10: 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

示例11: WriteXml

        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement(TransliterationSettingsElementName);

            writer.WriteStartElement(ModeElementName);
            writer.WriteValue(Mode.ToString());
            writer.WriteEndElement();

            writer.WriteStartElement(FileNameElementName);
            writer.WriteValue(FileName);
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
开发者ID:npuBug,项目名称:fb2epub,代码行数:14,代码来源:TransliterationSettingsImp.cs

示例12: WriteElement

        public void WriteElement(IAixmConverter converter, int flow, JObject feature, XmlWriter writer)
        {
            var id = feature["properties"]["id"];

            if (flow == 0)
            {
                if (id != null)
                {
                    if (id is JObject)
                    {
                        writer.WriteStartElement("gml", "identifier", null);
                        var obj = id as JObject;
                        foreach(var prop in obj.Properties().Where(p=>p.Name.StartsWith("@")))
                        { 
                            writer.WriteAttributeString(prop.Name.Substring(1), prop.Value.ToString());
                        }
                        writer.WriteValue(id["#text"].ToString());
                        writer.WriteEndElement();


                    }else{
                        writer.WriteElementString("gml", "identifier", null, id.ToString());
                    }
                }   
            }
            else
            {
               

            }
        }
开发者ID:s-innovations,项目名称:S-Innovations.Aixm,代码行数:31,代码来源:GMLIdentifierConvertor.cs

示例13: SerializeAnalyticsSettings

        /// <summary> 
        /// Write the settings provided to stream 
        /// </summary> 
        /// <param name="inputStream"></param> 
        /// <returns></returns> 
        public static void SerializeAnalyticsSettings(XmlWriter xmlWriter, AnalyticsSettings settings)
        {
            xmlWriter.WriteStartDocument();
            xmlWriter.WriteStartElement(SettingsSerializerHelper.RootPropertiesElementName);

            //LOGGING STARTS HERE
            xmlWriter.WriteStartElement(SettingsSerializerHelper.LoggingElementName);

            xmlWriter.WriteStartElement(SettingsSerializerHelper.VersionElementName);
            xmlWriter.WriteValue(settings.LogVersion);
            xmlWriter.WriteEndElement();

            bool isReadEnabled = (settings.LogType & LoggingLevel.Read) != LoggingLevel.None;
            xmlWriter.WriteStartElement(SettingsSerializerHelper.ApiTypeReadElementName);
            xmlWriter.WriteValue(isReadEnabled);
            xmlWriter.WriteEndElement();

            bool isWriteEnabled = (settings.LogType & LoggingLevel.Write) != LoggingLevel.None;
            xmlWriter.WriteStartElement(SettingsSerializerHelper.ApiTypeWriteElementName);
            xmlWriter.WriteValue(isWriteEnabled);
            xmlWriter.WriteEndElement();

            bool isDeleteEnabled = (settings.LogType & LoggingLevel.Delete) != LoggingLevel.None;
            xmlWriter.WriteStartElement(SettingsSerializerHelper.ApiTypeDeleteElementName);
            xmlWriter.WriteValue(isDeleteEnabled);
            xmlWriter.WriteEndElement();

            SerializeRetentionPolicy(xmlWriter, settings.IsLogRetentionPolicyEnabled, settings.LogRetentionInDays);
            xmlWriter.WriteEndElement(); // logging element

            //METRICS STARTS HERE
            xmlWriter.WriteStartElement(SettingsSerializerHelper.MetricsElementName);

            xmlWriter.WriteStartElement(SettingsSerializerHelper.VersionElementName);
            xmlWriter.WriteValue(settings.MetricsVersion);
            xmlWriter.WriteEndElement();

            bool isServiceSummaryEnabled = (settings.MetricsType & MetricsType.ServiceSummary) != MetricsType.None;
            xmlWriter.WriteStartElement(SettingsSerializerHelper.MetricsEnabledElementName);
            xmlWriter.WriteValue(isServiceSummaryEnabled);
            xmlWriter.WriteEndElement();

            if (isServiceSummaryEnabled)
            {
                bool isApiSummaryEnabled = (settings.MetricsType & MetricsType.ApiSummary) != MetricsType.None;
                xmlWriter.WriteStartElement(SettingsSerializerHelper.IncludeApiSummaryElementName);
                xmlWriter.WriteValue(isApiSummaryEnabled);
                xmlWriter.WriteEndElement();
            }

            SerializeRetentionPolicy(
                xmlWriter,
                settings.IsMetricsRetentionPolicyEnabled,
                settings.MetricsRetentionInDays);
            xmlWriter.WriteEndElement();
            // metrics
            xmlWriter.WriteEndElement();
            // root element
            xmlWriter.WriteEndDocument();
        }
开发者ID:flin-aa,项目名称:Windows-Monitoring-Scripts,代码行数:65,代码来源:SettingsSerializerHelper.cs

示例14: Save

 internal override void Save (XmlWriter writer)
 {
         writer.WriteStartElement (XmlName);
         if (!string.IsNullOrWhiteSpace (Value))
                 writer.WriteValue (Value);
         writer.WriteEndElement ();
 }
开发者ID:attachmate-snapshot,项目名称:mono,代码行数:7,代码来源:ProjectPropertyElement.cs

示例15: SerializeToXML

        public override void SerializeToXML(XmlWriter writer)
        {
            writer.WriteStartElement("Loop");

            foreach (ParamInputModel param in Activity.InputParam)
            {
                string paramValue = param.Value != null ? param.Value.ToString() : param.ValueStr == null ? param.ValueStr : null;

                if (paramValue != null)
                {
                    writer.WriteStartElement(param.IsInputParam ? "InboundParam" : "OutboundParam");
                    writer.WriteAttributeString("name", param.Name);
                    writer.WriteAttributeString("type", param.DataType);
                    writer.WriteStartElement("Value");
                    writer.WriteValue(paramValue); //todo
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
            }


            writer.WriteAttributeString("cycles", "0");
            writer.WriteAttributeString("increment", "1");

            foreach (StandardFlowModel activity in NestedModels)
            {
                activity.SerializeToXML(writer);
            }

            writer.WriteEndElement();
        }
开发者ID:SamuelToh,项目名称:Masters_Degree_Major_Project,代码行数:31,代码来源:ForLoopFlowModel.cs


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