本文整理汇总了C#中System.Xml.XmlTextWriter.WriteRaw方法的典型用法代码示例。如果您正苦于以下问题:C# XmlTextWriter.WriteRaw方法的具体用法?C# XmlTextWriter.WriteRaw怎么用?C# XmlTextWriter.WriteRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlTextWriter
的用法示例。
在下文中一共展示了XmlTextWriter.WriteRaw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteRSSClosing
public XmlTextWriter WriteRSSClosing(XmlTextWriter writer)
{
/*
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();
*/
writer.WriteRaw("\t</channel>" + en);
writer.WriteRaw("</rss>");
return writer;
}
示例2: GenerateDescription
private void GenerateDescription(string host = null)
{
MemoryStream memStream = new MemoryStream();
using (XmlTextWriter descWriter = new XmlTextWriter(memStream, new UTF8Encoding(false)))
{
descWriter.Formatting = Formatting.Indented;
descWriter.WriteRaw("<?xml version=\"1.0\"?>");
descWriter.WriteStartElement("root", "urn:schemas-upnp-org:device-1-0");
descWriter.WriteStartElement("specVersion");
descWriter.WriteElementString("major", "1");
descWriter.WriteElementString("minor", "0");
descWriter.WriteEndElement();
descWriter.WriteStartElement("device");
rootDevice.WriteDescription(descWriter, host);
descWriter.WriteEndElement();
descWriter.WriteEndElement();
descWriter.Flush();
descArray = memStream.ToArray();
}
}
示例3: Save
public void Save(string fileName)
{
if (this.Messages.Count == 0 || string.IsNullOrEmpty(fileName)) return;
if (File.Exists(fileName)) File.Delete(fileName);
var xml = new XmlDocument();
xml.AppendChild(xml.CreateXmlDeclaration(this.Declaration.Version, this.Declaration.Encoding, this.Declaration.Standalone));
xml.AppendChild(xml.CreateProcessingInstruction(this.Xsl.Target, this.Xsl.Data));
var root = xml.CreateElement("Log");
root.SetAttribute("FirstSessionID", this.Messages[0].SessionID.ToString());
root.SetAttribute("LastSessionID", this.Messages[this.Messages.Count - 1].SessionID.ToString());
xml.AppendChild(root);
this.Messages.ForEach(messageNode =>
{
var nodeName = messageNode.GetType().Name.Replace("Msn", string.Empty);
var newNode = xml.CreateElement(nodeName);
root.AppendChild(messageNode.GenerateXmlNode(newNode));
});
var writer = new XmlTextWriter(fileName, Encoding.UTF8);
writer.WriteRaw(xml.OuterXml);
writer.Flush();
writer.Close();
}
示例4: ProcessRequest
public void ProcessRequest(HttpContext context)
{
string configName = context.Request.QueryString["configuration"];
_configuration = CodeGenerationSettings.Instance.GetConfiguration(configName);
context.Response.ContentType = "text/plain";
using (XmlTextWriter writer = new XmlTextWriter(context.Response.OutputStream, Encoding.UTF8))
{
writer.Formatting = Formatting.Indented;
writer.WriteRaw("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n");
writer.WriteStartElement("namespaces");
_templates = _configuration.GetTemplateSettings().ToDictionary(t => t.Path);
foreach (var nameSpace in _templates.Values.GroupBy(c => c.NameSpace))
{
writer.WriteStartElement("namespace");
writer.WriteAttributeString("name", nameSpace.Key);
foreach (var template in nameSpace)
WriteTemplate(template, writer);
writer.WriteEndElement();
}
writer.WriteEndElement();
}
}
示例5: WriteSalesReports
public void WriteSalesReports(string reports)
{
using (var writer = new XmlTextWriter(this.Path, null))
{
writer.WriteStartDocument();
writer.WriteRaw(Environment.NewLine + reports);
}
}
示例6: StartLog
internal void StartLog(string logFile, string xslPath)
{
m_logFile = logFile;
m_xmlWriter = new XmlTextWriter(logFile, Encoding.UTF8);
m_xmlWriter.Formatting = Formatting.Indented;
m_xmlWriter.WriteStartDocument();
m_xmlWriter.WriteRaw("<?xml-stylesheet type=\"text/xsl\" href=\"" + xslPath + "\"?>");
m_xmlWriter.WriteStartElement("SPOT_Platform_Test");
}
示例7: Cut
public static void Cut()
{
var xml = "";
using (var reader = XmlReader.Create("company.xml"))
{
while (reader.Read())
{
if (!String.IsNullOrEmpty(reader.Name))
{
var el = @"<";
switch (reader.NodeType)
{
case XmlNodeType.EndElement:
el += @"/" + reader.Name;
break;
case XmlNodeType.Element:
case XmlNodeType.XmlDeclaration:
el += reader.Name;
break;
}
if (reader.AttributeCount > 0)
{
el += " ";
while (reader.MoveToNextAttribute())
{
var a = string.Format("{0}={1}", reader.Name, reader.Value);
el += a;
}
xml += el + @">";
}
else
{
xml += el + reader.Value + @">";
}
if (reader.Name == "Salary")
{
if (reader.Read())
{
var s = reader.ReadContentAsDecimal() / 2;
xml += s + @"</Salary>";
}
}
}
else
{
xml += reader.Value;
}
}
}
using (var tw = new XmlTextWriter("company1.xml", Encoding.UTF8))
{
tw.WriteRaw(xml);
}
}
示例8: OpenMetadataDoc
public void OpenMetadataDoc(string urlMetadataDoc)
{
string tmpInput = GenerateTempFilename("Meta", "xml");
XmlWriter pXWriter = new XmlTextWriter(tmpInput, Encoding.UTF8);
pXWriter.WriteRaw(GetMetadataDoc(urlMetadataDoc));
pXWriter.Close();
string tmpOutput = XmlTransform(tmpInput);
webBrowserMetadata.Navigate(tmpOutput);
}
示例9: WriteBody
private void WriteBody(XmlTextWriter xml)
{
xml.WriteStartElement("Body");
xml.WriteStartElement("Content");
xml.WriteRaw(this.Definition.Body);
xml.WriteEndElement();
this.WriteGridViews(xml);
xml.WriteEndElement();
}
示例10: DumpLayoutAndVisualTree
/// <summary>
/// Dump layout and visual tree starting from specified root.
/// </summary>
/// <param name="writer">Stream for dump output.</param>
/// <param name="tagName">Name of the root XML element.</param>
/// <param name="root">Root of the visual subtree.</param>
internal static void DumpLayoutAndVisualTree(XmlTextWriter writer, string tagName, Visual root)
{
// Write root element
writer.WriteStartElement(tagName);
// Dump layout tree including all visuals
DumpVisual(writer, root, root);
// Write end root
writer.WriteEndElement();
writer.WriteRaw("\r\n"); // required for bbpack
}
示例11: RenderAsHtml
public string RenderAsHtml ()
{
StringWriter sw = new StringWriter ();
XmlWriter w = new XmlTextWriter (sw);
if (HelpSource.use_css)
w.WriteRaw ("<div class=\"header\" id=\"error_ref\">" +
" <div class=\"subtitle\">Compiler Error Reference</div> " +
" <div class=\"title\">Error " + ErrorName + " </div></div>");
else
w.WriteRaw (@"
<table width='100%'>
<tr bgcolor='#b0c4de'><td>
<i>Compiler Error Reference</i>
<h3>Error " + ErrorName + @"</h2>
</td></tr>
</table><br />");
if (Details != null) {
if (HelpSource.use_css)
w.WriteRaw ("<div class=\"summary\">Summary</div>");
else
w.WriteRaw (@"<h3>Summary</h3>");
Details.Summary.WriteTo (w);
if (HelpSource.use_css)
w.WriteRaw ("<div class=\"details\">Details</div>");
else
w.WriteRaw (@"<h3>Details</h3>");
Details.Details.WriteTo (w);
}
foreach (string xmp in Examples) {
if (HelpSource.use_css)
w.WriteRaw ("<div class=\"code_example\">" +
"<div class=\"code_ex_title\">Example</div>");
else
w.WriteRaw (@"<table bgcolor='#f5f5dd' border='1'>
<tr><td><b><font size='-1'>Example</font></b></td></tr>
<tr><td><font size='-1'><pre>");
w.WriteRaw (Mono.Utilities.Colorizer.Colorize (xmp, "c#"));
if (HelpSource.use_css)
w.WriteRaw ("</div>");
else
w.WriteRaw (@"</pre></font></td></tr></table>");
}
w.Close ();
return sw.ToString ();
}
示例12: WriteRSSPrologue
public XmlTextWriter WriteRSSPrologue(XmlTextWriter writer, pages.ForumPage page)
{
/*
writer.WriteStartDocument();
writer.WriteStartElement("rss");
writer.WriteAttributeString("version", "2.0");
writer.WriteStartElement("channel");
writer.WriteElementString("title", "RSS File for " + page.ForumURL);
writer.WriteElementString("link", page.ForumURL);
writer.WriteElementString("description", "Yet Another Forum Web Application");
writer.WriteElementString("copyright", "Copyright 2002-2004 Bjørnar Henden");
*/
writer.WriteRaw("<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + en);
writer.WriteRaw("<?xml-stylesheet type=\"text/xsl\" href=\"rss.xsl\" media=\"screen\"?>");
writer.WriteRaw("<rss version=\"2.0\">" + en);
writer.WriteRaw("\t<channel>" + en);
writer.WriteRaw("\t\t<title>RSS Feed for " + page.ServerURL + "</title>" + en);
writer.WriteRaw("\t\t<link>" + Encode(page.ForumURL) + "</link>" + en);
writer.WriteRaw("\t\t<description>Yet Another Forum Web Application RSS Feed</description>" + en);
writer.WriteRaw("\t\t<copyright>Copyright 2002 - 2005 Bjørnar Henden</copyright>" + en);
return writer;
}
示例13: WriteXML
private void WriteXML()
{
string xml = "<?xml version=\"1.0\" standalone=\"yes\"?>"+ Environment.NewLine +"<users>" + Environment.NewLine;
foreach (XmlUser user in users)
{
xml += "<user>" + Environment.NewLine;
xml += "<name>" + user.Name + "</name>" + Environment.NewLine;
xml += "<email>" + user.Email + "</email>" + Environment.NewLine;
xml += "</user>" + Environment.NewLine;
}
xml += "</users>" +Environment.NewLine;
XmlTextWriter writer = new XmlTextWriter(Server.MapPath("/App_Data/XmlInjectionUsers.xml"), Encoding.UTF8);
writer.WriteRaw(xml);
writer.Close();
}
示例14: ToXML
public String ToXML()
{
System.IO.StringWriter XMLsw = new System.IO.StringWriter();
XmlTextWriter XMLtw = new XmlTextWriter(XMLsw);
XMLtw.Formatting = Formatting.Indented;
XMLtw.WriteStartElement("hackset");
XMLtw.WriteStartElement("hackvalues");
for (int x=0; x < HackValues.Length; x++)
{
XMLtw.WriteRaw(HackValues[x].ToXML());
}
XMLtw.WriteEndElement();
XMLtw.WriteEndElement();
return XMLsw.ToString();
}
示例15: ToXML
public static string ToXML(string path)
{
DirectoryInfo di = new DirectoryInfo(path);
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
XmlTextWriter writer = new XmlTextWriter(sw);
writer.Formatting = Formatting.Indented;
writer.WriteRaw("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
writer.WriteStartElement("theme");
DirectoryToXML(di,writer);
writer.WriteEndElement();
return sb.ToString();
}