本文整理汇总了C#中XmlTextWriter.WriteRaw方法的典型用法代码示例。如果您正苦于以下问题:C# XmlTextWriter.WriteRaw方法的具体用法?C# XmlTextWriter.WriteRaw怎么用?C# XmlTextWriter.WriteRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlTextWriter
的用法示例。
在下文中一共展示了XmlTextWriter.WriteRaw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlNodeListToString
public static string XmlNodeListToString(XmlNodeList nodeList, int indentation)
{
if (nodeList==null)
{
return "-- NULL --";
}
using (var sw = new StringWriter())
{
using (var xw = new XmlTextWriter(sw))
{
xw.Formatting = Formatting.Indented;
xw.Indentation = indentation;
xw.WriteRaw("<result>");
foreach(XmlNode node in nodeList)
{
node.WriteTo(xw);
}
xw.WriteRaw("</result>");
}
return sw.ToString();
}
}
示例2: Main
//.........这里部分代码省略.........
XmlNamespaceManager manager = new XmlNamespaceManager (nav.NameTable);
manager.AddNamespace ("dia",
"http://www.lysator.liu.se/~alla/dia/dia-sheet-ns");
// Build language list
ArrayList languages = new ArrayList ();
languages.Add ("en");
XPathExpression namequery = nav.Compile ("/dia:sheet/dia:name");
namequery.SetContext (manager);
XPathNodeIterator names = nav.Select (namequery);
while (names.MoveNext ())
{
if ("" != names.Current.XmlLang)
languages.Add (names.Current.XmlLang);
}
XPathExpression sheetdescquery =
nav.Compile ("/dia:sheet/dia:description");
sheetdescquery.SetContext (manager);
foreach (string language in languages)
{
// includes are not available for all languages, fall back to en
string includelanguage = "en";
if (("de" == language) || ("es" == language) || ("fr" == language))
includelanguage = language;
string outputfilename =
outputdir.ToString () + "/index." + output_suffix;
if ("en" != language)
outputfilename = outputfilename + "." + language;
XmlTextWriter output =
new XmlTextWriter (outputfilename, System.Text.Encoding.UTF8);
output.Formatting = Formatting.Indented;
if (output_tpl)
{
output.WriteRaw ("{include file='header.tpl' language='" +
includelanguage + "'}");
}
else
{
output.WriteStartElement ("html");
output.WriteAttributeString ("xmlns",
"http://www.w3.org/1999/xhtml");
output.WriteAttributeString ("lang", language);
output.WriteAttributeString ("xml:lang", language);
output.WriteStartElement ("head");
}
names = nav.Select (namequery);
string sheetname = GetValueI18n (language, names);
XPathNodeIterator sheetdescriptions = nav.Select (sheetdescquery);
string sheetdescription = GetValueI18n (language, sheetdescriptions);
output.WriteElementString ("title",
"{t}Dia Sheet{/t} " + sheetname + ": " +
sheetdescription);
output.WriteStartElement ("meta");
output.WriteAttributeString ("http-equiv", "Content-type");
output.WriteAttributeString ("content", "text/html; charset=utf-8");
output.WriteEndElement ();
if (output_tpl)
{
output.WriteStartElement ("link");
output.WriteAttributeString ("rel", "canonical");
output.WriteAttributeString ("href",
"http://dia-installer.de/shapes/" +
args[args.Length - 1] +
"/index.html." + language);