fork(2) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using System.Xml;
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. public static void Main(string[] args)
  11. {
  12. var doc = new XmlDocument();
  13. var stream = Console.Out;
  14.  
  15. XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "utf-8", null);
  16. XmlElement rootNode = doc.CreateElement("rexim", "rexim:coding-team:test");
  17. rootNode.InnerText = "давлоыдаывалдыовадлы";
  18. doc.InsertBefore(xmlDeclaration, doc.DocumentElement);
  19. doc.AppendChild(rootNode);
  20.  
  21. XmlWriterSettings settings = new XmlWriterSettings()
  22. {
  23. Indent = true
  24. };
  25.  
  26. using( var writer = XmlWriter.Create(stream,settings)) {
  27. doc.Save(writer);
  28. }
  29. }
  30. }
  31. }
  32.  
Success #stdin #stdout 0.09s 24496KB
stdin
Standard input is empty
stdout
<?xml version="1.0" encoding="utf-8"?>
<rexim xmlns="rexim:coding-team:test">давлоыдаывалдыовадлы</rexim>