• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Xml.XmlWriterSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.XmlWriterSettings的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlWriterSettings类的具体用法?C# System.Xml.XmlWriterSettings怎么用?C# System.Xml.XmlWriterSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.Xml.XmlWriterSettings类属于命名空间,在下文中一共展示了System.Xml.XmlWriterSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: cloneWS

        public void cloneWS()
        {
            Makro newws;

            using (MemoryStream stream = new MemoryStream())
            {
                System.Xml.XmlWriterSettings ws = new System.Xml.XmlWriterSettings();
                ws.NewLineHandling = System.Xml.NewLineHandling.Entitize;

                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(Makro));
                using (System.Xml.XmlWriter wr = System.Xml.XmlWriter.Create(stream, ws))
                {
                    x.Serialize(wr, CurrentMakro);
                }
                stream.Position = 0;

                System.Xml.XmlReaderSettings rs = new System.Xml.XmlReaderSettings();

                using (System.Xml.XmlReader rd = System.Xml.XmlReader.Create(stream, rs))
                {
                    newws = (Makro)x.Deserialize(rd, "");
                }
                //newws = (Makro)x.Deserialize(stream);
            }

            newws.Name += "_Copy";

            Makros.Add(newws);
            listBoxMakros.SelectedItem = newws;
        }
开发者ID:kleinsimon,项目名称:TCMM,代码行数:30,代码来源:Form1.cs


示例2: Write

 public static void Write(string file, Map overview)
 {
     if (string.IsNullOrEmpty(file))
         throw new Exception("File Not Empty");
     System.Xml.Serialization.XmlSerializer writer =
     new System.Xml.Serialization.XmlSerializer(typeof(Map));
     System.Xml.XmlWriterSettings setting = new System.Xml.XmlWriterSettings();
     setting.Encoding = Encoding.UTF8;
     setting.CloseOutput = true;
     setting.NewLineChars = "\r\n";
     setting.Indent = true;
     if (!File.Exists(file))
     {
         using (Stream s = File.Open(file, FileMode.OpenOrCreate))
         {
             System.Xml.XmlWriter tmp = System.Xml.XmlWriter.Create(s, setting);
             writer.Serialize(tmp, overview);
         }
     }
     else
     {
         using (Stream s = File.Open(file, FileMode.Truncate))
         {
             System.Xml.XmlWriter tmp = System.Xml.XmlWriter.Create(s, setting);
             writer.Serialize(tmp, overview);
         }
     }
 }
开发者ID:iceriver102,项目名称:alta-mtc-version-2,代码行数:28,代码来源:Map.cs


示例3: Export

        public static void Export(TLArtifactsCollection artifactsCollection, string outputPath, string collectionId, string name, string version, string description)
        {
            if (artifactsCollection == null)
            {
                throw new TraceLabSDK.ComponentException("Received null artifacts collection.");
            }

            System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
            settings.Indent = true;
            settings.CloseOutput = true;
            settings.CheckCharacters = true;

            //create file
            using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(outputPath, settings))
            {
                writer.WriteStartDocument();

                writer.WriteStartElement("artifacts_collection");

                WriteCollectionInfo(writer, collectionId, name, version, description);

                WriteArtifacts(artifactsCollection, writer);

                writer.WriteEndElement(); //artifacts_collection

                writer.WriteEndDocument();

                writer.Close();
            }

            System.Diagnostics.Trace.WriteLine("File created , you can find the file " + outputPath);
        }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:32,代码来源:ArtifactsCollectionExporterUtilities.cs


示例4: Export

        public static void Export(TLSimilarityMatrix answerSet, string sourceId, string targetId, string outputPath)
        {
            if (answerSet == null)
            {
                throw new TraceLabSDK.ComponentException("Received null answer similarity matrix");
            }

            System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
            settings.Indent = true;
            settings.CloseOutput = true;
            settings.CheckCharacters = true;

            //create file
            using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(outputPath, settings))
            {
                writer.WriteStartDocument();

                writer.WriteStartElement("answer_set");

                WriteAnswerSetInfo(writer, sourceId, targetId);

                WriteLinks(answerSet, writer);

                writer.WriteEndElement(); //answer_set

                writer.WriteEndDocument();

                writer.Close();
            }

            System.Diagnostics.Trace.WriteLine("File created , you can find the file " + outputPath);
        }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:32,代码来源:AnswerSetExporterUtilities.cs


示例5: Writer

        /// <summary>
        /// Handling of data to be written.
        /// Startup = Check if initial directory(s) have been created, ifnot do.
        /// Remove = Removes an entry physically.
        /// Entry = Saves an entry to a xml file via System.Xml.XmlWriter.
        /// </summary>

        void Writer(string Command, string Addition)
        {
            if (Command == "Startup") { //Check for initial directory(s).
                if (System.IO.Directory.Exists(stringDirectoryProgramDatabase) == false) {
                    System.IO.Directory.CreateDirectory(stringDirectoryProgramDatabase);
                }

            } else if (Command == "Remove") { //Removes the physical from the HD.
                // msgbox then delete stringFileCurrent+"day".xml
                try {
                    messageboxResult = MessageBox.Show("Sure you want to delete Entry '" + TextboxDetailsMonth.Text + "-" + TextboxDetailsDay.Text + "_" + TextboxDetailsTime.Text + "_" + TextboxDetailsAuthor.Text + "'?", "Delete entry", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                } catch (System.Exception e) {
                    MessageBox.Show("You have to load the entry to mark it for remove.");
                }
                if (messageboxResult == DialogResult.Yes) {
                    //Delete directory
                    try {
                        System.IO.File.Delete(stringFileCurrent + "\\" + TextboxDetailsMonth.Text + "-" + TextboxDetailsDay.Text + "_" + TextboxDetailsTime.Text + "_" + TextboxDetailsAuthor.Text + ".xml");
                    } catch (System.Exception e) {
                    }
                }
            } else if (Command == "Entry") {
                stringFileCurrent = stringDirectoryProgramDatabase;
                stringFileCurrent += ToolstripButtonListSolution.Text;
                stringFileCurrent += "\\";
                stringFileCurrent += ToolstripButtonListProgram.Text;
                stringFileCurrent += "\\";
                stringFileCurrent += ToolstripButtonListVersion.Text;
                if (Addition == "Save") {
                    // Create new structure from stringFileCurrent
                    System.IO.Directory.CreateDirectory(stringFileCurrent);
                    System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
                    settings.Indent = true;
                    //Start WriterXML With stringFileCurrent + "Day".XML
                    using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(stringFileCurrent + "\\" + TextboxDetailsMonth.Text + "-" + TextboxDetailsDay.Text + "_" + TextboxDetailsTime.Text + "_" + TextboxDetailsAuthor.Text + ".xml", settings)) {
                        // Begin writing.
                        writer.WriteStartDocument();
                        writer.WriteStartElement("Information");
                        //> Information
                        writer.WriteElementString("Year", TextboxDetailsYear.Text);
                        writer.WriteElementString("Month", TextboxDetailsMonth.Text);
                        writer.WriteElementString("Day", TextboxDetailsDay.Text);
                        writer.WriteElementString("Time", TextboxDetailsTime.Text);
                        writer.WriteElementString("Author", TextboxDetailsAuthor.Text);
                        writer.WriteElementString("ReferenceID", TextboxDetailsReference.Text);
                        writer.WriteElementString("Reply", TextboxDetailsReplied.Text);
                        writer.WriteElementString("BugID", TextboxDetailsBugLink.Text);
                        writer.WriteElementString("Category", TextboxDetailsCategory.Text);
                        writer.WriteElementString("Change", TextboxDetailsChange.Text);
                        writer.WriteElementString("Description", TextboxDetailsDescription.Text);
                        writer.WriteElementString("Comment", TextboxDetailsComment.Text);
                        // End document.
                        writer.WriteEndDocument();
                    }
                    ListviewListEntries.Items.Insert(0, ToolstripButtonListVersion.Text);
                    ListviewListEntries.Items[0].Selected = true;
                    Reader("Load", "Version"); 
                }
            }
        }
开发者ID:GerardSchornagel,项目名称:ChangeLogger,代码行数:67,代码来源:MainForm.Write.cs


示例6: Serialize

        public static string Serialize(object oObject, bool Indent = false)
        {
            System.Xml.Serialization.XmlSerializer oXmlSerializer = null;
            System.Text.StringBuilder oStringBuilder = null;
            System.Xml.XmlWriter oXmlWriter = null;
            string sXML = null;
            System.Xml.XmlWriterSettings oXmlWriterSettings = null;
            System.Xml.Serialization.XmlSerializerNamespaces oXmlSerializerNamespaces = null;

            // -----------------------------------------------------------------------------------------------------------------------
            // Lage XML
            // -----------------------------------------------------------------------------------------------------------------------
            oStringBuilder = new System.Text.StringBuilder();
            oXmlSerializer = new System.Xml.Serialization.XmlSerializer(oObject.GetType());
            oXmlWriterSettings = new System.Xml.XmlWriterSettings();
            oXmlWriterSettings.OmitXmlDeclaration = true;
            oXmlWriterSettings.Indent = Indent;
            oXmlWriter = System.Xml.XmlWriter.Create(new System.IO.StringWriter(oStringBuilder), oXmlWriterSettings);
            oXmlSerializerNamespaces = new System.Xml.Serialization.XmlSerializerNamespaces();
            oXmlSerializerNamespaces.Add(string.Empty, string.Empty);
            oXmlSerializer.Serialize(oXmlWriter, oObject, oXmlSerializerNamespaces);
            oXmlWriter.Close();
            sXML = oStringBuilder.ToString();

            return sXML;
        }
开发者ID:phuongnt,项目名称:testmvc,代码行数:26,代码来源:Utility.cs


示例7: writeValues

        private void writeValues(System.IO.StringWriter oStringWriter)
        {
            System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
            settings.Encoding = Encoding.UTF8;
            settings.ConformanceLevel = System.Xml.ConformanceLevel.Auto;

            System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(oStringWriter,settings);

            writer.WriteRaw("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            writer.WriteStartElement("report");
            writer.WriteAttributeString("date", DateTime.Now.ToString("yyyyMMdd_HHmm"));
            foreach (var row in Current.Context.Report.GetResultElements())
            {

                writer.WriteStartElement("result");
                foreach (var col in row.GetColumnNames())
                {
                    writer.WriteStartElement("column");
                    writer.WriteAttributeString("name", col);
                    writer.WriteString(row.GetColumnValue(col));
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.Flush();
        }
开发者ID:earlnuclear,项目名称:AdvancedSystemReporter,代码行数:29,代码来源:XMLExport.cs


示例8: Build

        public object Build(
            XmlUtilities.XmlModule moduleToBuild,
            out bool success)
        {
            var node = moduleToBuild.OwningNode;

            var xmlLocation = moduleToBuild.Locations[XmlUtilities.XmlModule.OutputFile];
            var xmlPath = xmlLocation.GetSinglePath();
            if (null == xmlPath)
            {
                throw new Bam.Core.Exception("XML output path was not set");
            }

            // dependency checking
            {
                var outputFiles = new Bam.Core.StringArray();
                outputFiles.Add(xmlPath);
                if (!RequiresBuilding(outputFiles, new Bam.Core.StringArray()))
                {
                    Bam.Core.Log.DebugMessage("'{0}' is up-to-date", node.UniqueModuleName);
                    success = true;
                    return null;
                }
            }

            Bam.Core.Log.Info("Writing XML file '{0}'", xmlPath);

            // create all directories required
            var dirsToCreate = moduleToBuild.Locations.FilterByType(Bam.Core.ScaffoldLocation.ETypeHint.Directory, Bam.Core.Location.EExists.WillExist);
            foreach (var dir in dirsToCreate)
            {
                var dirPath = dir.GetSinglePath();
                NativeBuilder.MakeDirectory(dirPath);
            }

            // serialize the XML to disk
            var settings = new System.Xml.XmlWriterSettings();
            settings.CheckCharacters = true;
            settings.CloseOutput = true;
            settings.ConformanceLevel = System.Xml.ConformanceLevel.Auto;
            settings.Indent = true;
            settings.IndentChars = new string(' ', 4);
            settings.NewLineChars = "\n";
            settings.NewLineHandling = System.Xml.NewLineHandling.None;
            settings.NewLineOnAttributes = false;
            settings.OmitXmlDeclaration = false;
            settings.Encoding = new System.Text.UTF8Encoding(false); // do not write BOM

            using (var xmlWriter = System.Xml.XmlWriter.Create(xmlPath, settings))
            {
                moduleToBuild.Document.WriteTo(xmlWriter);
                xmlWriter.WriteWhitespace(settings.NewLineChars);
            }

            success = true;
            return null;
        }
开发者ID:knocte,项目名称:BuildAMation,代码行数:57,代码来源:XmlWriter.cs


示例9: GetSettingXml

 public string GetSettingXml()
 {
     System.Xml.Serialization.XmlSerializer serializer =
         new System.Xml.Serialization.XmlSerializer(typeof(AlarmSetting));
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     System.Xml.XmlWriterSettings xmlwritersetting = new System.Xml.XmlWriterSettings();
     xmlwritersetting.Encoding = Encoding.UTF8;
     System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create(ms, xmlwritersetting);
     serializer.Serialize(xmlWriter, this);
     return Encoding.GetEncoding("utf-8").GetString(ms.ToArray());
 }
开发者ID:masahoshiro,项目名称:FinalFantasyXIV_ARR_Tools,代码行数:11,代码来源:AlermSetting.cs


示例10: XmlDocWriterBase

        public XmlDocWriterBase(string filename)
        {
            this.stack = new Stack<string>();
            if (filename == null)
            {
                throw new System.ArgumentNullException("filename");
            }

            var settings = new System.Xml.XmlWriterSettings();
            settings.Indent = true;
            this._xw = System.Xml.XmlWriter.Create(filename, settings);
        }
开发者ID:saveenr,项目名称:saveenr,代码行数:12,代码来源:XmlDocWriterBase.cs


示例11: CreateReportXAML

        /// <summary>
        /// Creates the report.
        /// </summary>
        public string CreateReportXAML(string serverUrl, ReportConfig config)
        {
            if (config.StaticXAMLReport != null)
                return config.StaticXAMLReport;

            // load the xslt template
            System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform();
            try {
                LoadTemplate(xslt, serverUrl, config.ReportGroup, config.ReportTemplate);
            }
            catch (System.Exception) {
                throw new ScrumFactory.Exceptions.ScrumFactoryException("Error_reading_report_template");
            }

            // creates a buffer stream to write the report context in XML
            System.IO.BufferedStream xmlBuffer = new System.IO.BufferedStream(new System.IO.MemoryStream());
            System.Xml.XmlWriterSettings writerSettings = new System.Xml.XmlWriterSettings();
            writerSettings.CheckCharacters = false;
            writerSettings.OmitXmlDeclaration = true;

            System.Xml.XmlWriter reportDataStream = System.Xml.XmlWriter.Create(xmlBuffer, writerSettings);

            // write XML start tag
            reportDataStream.WriteStartDocument();
            reportDataStream.WriteStartElement("ReportData");

            // create report context in XML
            CreateDefaultXMLContext(reportDataStream, writerSettings, serverUrl, config);

            // finish XML document
            reportDataStream.WriteEndDocument();
            reportDataStream.Flush();

            xmlBuffer.Seek(0, System.IO.SeekOrigin.Begin);
            // debug
            //System.IO.StreamReader s = new System.IO.StreamReader(xmlBuffer);
            //string ss = s.ReadToEnd();

            System.Xml.XmlReaderSettings readerSettings = new System.Xml.XmlReaderSettings();
            readerSettings.CheckCharacters = false;
            System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(xmlBuffer, readerSettings);

            // creates a buffer stream to write the XAML flow document
            System.IO.StringWriter xamlBuffer = new System.IO.StringWriter();

            System.Xml.XmlWriter xamlWriter = System.Xml.XmlWriter.Create(xamlBuffer, writerSettings);

            // creates the flow document XMAL
            xslt.Transform(xmlReader, xamlWriter);

            // sets the flow document at the view
            return xamlBuffer.ToString();
        }
开发者ID:klot-git,项目名称:scrum-factory,代码行数:56,代码来源:Report.cs


示例12: ToFile

 public void ToFile(string fileName)
 {
     XmlSerializer xs = new XmlSerializer(typeof(gpx));
     FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
     System.Xml.XmlWriterSettings xmlWriterSettings = new System.Xml.XmlWriterSettings();
     xmlWriterSettings.Indent = false;
     xmlWriterSettings.NewLineOnAttributes = false;
     System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create(fs, xmlWriterSettings);
     xs.Serialize(xmlWriter, this);
     fs.Close();
     //xmlWriter.Close();
     fs.Dispose();
 }
开发者ID:deb761,项目名称:BikeMap,代码行数:13,代码来源:GPX10.cs


示例13: PostExecution

        PostExecution()
        {
            var graph = Bam.Core.Graph.Instance;
            var solution = graph.MetaData as VSSolution;
            if (0 == solution.Projects.Count())
            {
                throw new Bam.Core.Exception("No projects were generated");
            }

            var xmlWriterSettings = new System.Xml.XmlWriterSettings
                {
                    OmitXmlDeclaration = false,
                    Encoding = new System.Text.UTF8Encoding(false), // no BOM (Byte Ordering Mark)
                    NewLineChars = System.Environment.NewLine,
                    Indent = true
                };

            foreach (var project in solution.Projects)
            {
                var projectPathDir = System.IO.Path.GetDirectoryName(project.ProjectPath);
                if (!System.IO.Directory.Exists(projectPathDir))
                {
                    System.IO.Directory.CreateDirectory(projectPathDir);
                }

                var projectXML = project.Serialize();
                using (var xmlwriter = System.Xml.XmlWriter.Create(project.ProjectPath, xmlWriterSettings))
                {
                    projectXML.WriteTo(xmlwriter);
                }
                Bam.Core.Log.DebugMessage(PrettyPrintXMLDoc(projectXML));

                var projectFilterXML = project.Filter.Serialize();
                using (var xmlwriter = System.Xml.XmlWriter.Create(project.ProjectPath + ".filters", xmlWriterSettings))
                {
                    projectFilterXML.WriteTo(xmlwriter);
                }
                Bam.Core.Log.DebugMessage(PrettyPrintXMLDoc(projectFilterXML));
            }

            var solutionPath = Bam.Core.TokenizedString.Create("$(buildroot)/$(masterpackagename).sln", null).Parse();
            var solutionContents = solution.Serialize();
            using (var writer = new System.IO.StreamWriter(solutionPath))
            {
                writer.Write(solutionContents);
            }
            Bam.Core.Log.DebugMessage(solutionContents.ToString());

            Bam.Core.Log.Info("Successfully created Visual Studio solution file for package '{0}'\n\t{1}", graph.MasterPackage.Name, solutionPath);
        }
开发者ID:knocte,项目名称:BuildAMation,代码行数:50,代码来源:VSSolutionMeta.cs


示例14: PrepareDependenciesDump

		public void PrepareDependenciesDump ()
		{
			System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
			settings.Indent = true;
			settings.IndentChars = "\t";
			var depsFile = File.OpenWrite ("linker-dependencies.xml.gz");
			zipStream = new GZipStream (depsFile, CompressionMode.Compress);

			writer = System.Xml.XmlWriter.Create (zipStream, settings);
			writer.WriteStartDocument ();
			writer.WriteStartElement ("dependencies");
			writer.WriteStartAttribute ("version");
			writer.WriteString ("1.0");
			writer.WriteEndAttribute ();
		}
开发者ID:ritchiecarroll,项目名称:mono,代码行数:15,代码来源:Annotations.cs


示例15: PrettyPrintXMLDoc

 PrettyPrintXMLDoc(
     System.Xml.XmlDocument document)
 {
     var content = new System.Text.StringBuilder();
     var settings = new System.Xml.XmlWriterSettings
     {
         Indent = true,
         NewLineChars = System.Environment.NewLine,
         Encoding = new System.Text.UTF8Encoding(false) // no BOM
     };
     using (var writer = System.Xml.XmlWriter.Create(content, settings))
     {
         document.Save(writer);
     }
     return content.ToString();
 }
开发者ID:knocte,项目名称:BuildAMation,代码行数:16,代码来源:VSSolutionMeta.cs


示例16: PrepareDependenciesDump

		public void PrepareDependenciesDump ()
		{
			dependency_stack = new Stack<object> ();
			System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
			settings.Indent = true;
			settings.IndentChars = "\t";
			var depsFile = File.OpenWrite (string.Format ("linker-dependencies-{0}.xml.gz", DateTime.Now.Ticks));
			zipStream = new GZipStream (depsFile, CompressionMode.Compress);

			writer = System.Xml.XmlWriter.Create (zipStream, settings);
			writer.WriteStartDocument ();
			writer.WriteStartElement ("dependencies");
			writer.WriteStartAttribute ("version");
			writer.WriteString ("1.0");
			writer.WriteEndAttribute ();
		}
开发者ID:nelsonsar,项目名称:mono,代码行数:16,代码来源:Annotations.cs


示例17: PrepareDependenciesDump

		public void PrepareDependenciesDump (string filename)
		{
			dependency_stack = new Stack<object> ();
			System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
			settings.Indent = true;
			settings.IndentChars = "\t";
			var depsFile = File.OpenWrite (filename);
			zipStream = new GZipStream (depsFile, CompressionMode.Compress);

			writer = System.Xml.XmlWriter.Create (zipStream, settings);
			writer.WriteStartDocument ();
			writer.WriteStartElement ("dependencies");
			writer.WriteStartAttribute ("version");
			writer.WriteString ("1.0");
			writer.WriteEndAttribute ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:16,代码来源:Annotations.cs


示例18: formatXML

 public static string formatXML(string XMLPath, string outPath = null)
 {
     string fullPath = Path.GetDirectoryName(XMLPath);
     string fileName = Path.GetFileName(XMLPath);
     outPath = outPath ?? (XMLPath != null ? Path.Combine(fullPath, "performanceTempResults - " + fileName) 
                                           : Path.Combine(fullPath, "performanceTempResults.xml"));
     XElement mainFile = XElement.Load(XMLPath);
     List<testResult> testResults = parseXML(mainFile);
     XElement formattedResults = writeResults(testResults);
     FileStream outStream = new FileStream(outPath, FileMode.Create);
     System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
     settings.CheckCharacters = false;
     settings.Indent = true;
     settings.IndentChars = "  ";
     using (System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create(outStream, settings))
         formattedResults.Save(writer);
     return outPath;
 }
开发者ID:visia,项目名称:xunit-performance,代码行数:18,代码来源:FormatXML.cs


示例19: Write

 public static string Write(Permision overview)
 {
     if (overview==null)
         throw new Exception("File Not Empty");
     System.Xml.Serialization.XmlSerializer writer =
    new System.Xml.Serialization.XmlSerializer(typeof(Permision));
     System.Xml.XmlWriterSettings setting = new System.Xml.XmlWriterSettings();
     setting.Encoding = Encoding.UTF8;
     setting.CloseOutput = true;
     using (var sw = new StringWriter())
     {
         using (var xw = System.Xml.XmlWriter.Create(sw, setting))
         {
             writer.Serialize(xw, overview);
         }
         return sw.ToString();
     }
 }
开发者ID:iceriver102,项目名称:alta-mtc-version-2,代码行数:18,代码来源:Permision.cs


示例20: Serialize

 /// <summary>
 /// Serialisiert ein OSTC-Dokument
 /// </summary>
 /// <param name="value">OSTC-Dokument</param>
 /// <param name="encoding">Zeichensatz, der für die Erstellung der XML-Datei verwendet wird</param>
 /// <returns>Serialisiertes OSTC-Dokument</returns>
 public static byte[] Serialize(OstcAntrag value, Encoding encoding)
 {
     var serializer = new XmlSerializer(typeof(OstcAntrag));
     var output = new MemoryStream();
     var writerSettings = new System.Xml.XmlWriterSettings()
     {
         Encoding = encoding,
         Indent = true,
         NamespaceHandling = System.Xml.NamespaceHandling.OmitDuplicates,
         NewLineChars = "\n",
     };
     using (var writer = System.Xml.XmlWriter.Create(output, writerSettings))
     {
         var namespaces = new XmlSerializerNamespaces();
         namespaces.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
         serializer.Serialize(writer, value, namespaces);
     }
     return output.ToArray();
 }
开发者ID:dataline-gmbh,项目名称:Itsg.Ostc,代码行数:25,代码来源:OstcUtils.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SystemDiagnostics类代码示例发布时间:2022-05-24
下一篇:
C# Xml.XmlTextWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap