本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteRaw方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteRaw方法的具体用法?C# XmlDictionaryWriter.WriteRaw怎么用?C# XmlDictionaryWriter.WriteRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryWriter
的用法示例。
在下文中一共展示了XmlDictionaryWriter.WriteRaw方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnWriteBodyContents
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
writer.WriteStartElement("html");
writer.WriteStartElement("head");
writer.WriteElementString("title", "Request Failed");
writer.WriteRaw(@"<style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } h1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana; font-size: 1em;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}</style>");
writer.WriteEndElement(); //head
writer.WriteStartElement("body");
writer.WriteRaw("<div id='content'>");
writer.WriteElementString("h1", "Request Failed");
writer.WriteElementString("h3", Message);
writer.WriteRaw("</div>");
writer.WriteEndElement(); //body
writer.WriteEndElement(); //html
}
示例2: OnWriteBodyContents
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
XmlWriterSettings setting = new XmlWriterSettings();
setting.NewLineHandling = NewLineHandling.Entitize;
setting.CheckCharacters = false;
if (!string.IsNullOrEmpty(body))
{
writer.WriteRaw(body);
}
if (doc != null)
{
doc.WriteContentTo(writer);
writer.Flush();
}
}
示例3: OnWriteBodyContents
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
writer.WriteRaw(_message);
}
示例4: WriteObjectContent
public override void WriteObjectContent(XmlDictionaryWriter writer, Object graph)
{
string authToken = string.Format("<UserId>00000000-0000-0000-0000-000000000000</UserId><UserName>{0}</UserName><Password>{1}</Password>", _userName, _password);
writer.WriteRaw(authToken);
}
示例5: OnWriteHeaderContents
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteRaw(GetToken().OuterXml);
writer.WriteStartElement("Timestamp");
writer.WriteXmlnsAttribute("", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
writer.WriteAttributeString("Id", "Timestamp-79");
//Created
writer.WriteStartElement("Created");
writer.WriteString(this.token.ValidFrom.ToString("yyyy-MM-ddTHH:mm:ssZ"));
writer.WriteEndElement();
//Expires
writer.WriteStartElement("Expires");
writer.WriteString(this.token.ValidTo.ToString("yyyy-MM-ddTHH:mm:ssZ"));
writer.WriteEndElement();
writer.WriteEndElement();
}
示例6: OnWriteBodyContents
/// <summary>
/// Override the method to write the content to the XML dictionary writer.
/// </summary>
/// <param name="writer">Specify the output destination of the content.</param>
protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
{
MemoryStream ms = new MemoryStream();
XmlSerializer serializer = new XmlSerializer(typeof(EnvelopeBody));
serializer.Serialize(ms, this.requestEnvelope);
XmlDocument doc = new XmlDocument();
doc.LoadXml(System.Text.ASCIIEncoding.ASCII.GetString(ms.ToArray(), 0, ms.ToArray().Length));
ms.Dispose();
foreach (XmlNode node in doc.LastChild.ChildNodes)
{
if (node.Name == "RequestVersion")
{
writer.WriteRaw(node.OuterXml);
}
else if (node.Name == "RequestCollection")
{
this.WriteNode(node, writer);
}
else
{
throw new InvalidOperationException(string.Format("this element [{0}] is not expected element", node.Name));
}
}
}