本文整理汇总了C#中System.Xml.XmlWriter.WriteRaw方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteRaw方法的具体用法?C# XmlWriter.WriteRaw怎么用?C# XmlWriter.WriteRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteRaw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteResponseMessage
public void WriteResponseMessage ( XmlWriter writer, string innerXml, NuxleusAsyncResult asyncResult ) {
using (writer) {
writer.WriteStartDocument();
if (m_responseType == ResponseType.REDIRECT) {
writer.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='/service/transform/openid-redirect.xsl'");
}
writer.WriteStartElement("auth");
writer.WriteAttributeString("xml:base", "http://dev.amp.fm/");
writer.WriteAttributeString("status", m_status);
if (m_responseType == ResponseType.REDIRECT) {
writer.WriteElementString("url", "http://dev.amp.fm/");
}
if (m_responseType == ResponseType.QUERY_RESPONSE && innerXml != null) {
writer.WriteStartElement("response");
writer.WriteRaw(innerXml);
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndDocument();
}
asyncResult.CompleteCall();
}
示例2: WriteTo
public override void WriteTo(XmlWriter w)
{
Debug.Assert (this.expression != null);
Debug.Assert (w != null);
w.WriteRaw (this.expression);
}
示例3: Generate
public override void Generate(XmlWriter writer)
{
writer.WriteRaw("<?xml version=\"1.0\"?>");
writer.WriteStartElement(@"response", @"http://schemas.microsoft.com/2006/09/sip/mrasp");
if (Request != null)
{
writer.WriteAttributeString(@"requestID", Request.RequestId);
writer.WriteAttributeString(@"version", Request.Version);
}
writer.WriteAttributeString(@"serverVersion", ServerVersion);
if (Request != null)
{
writer.WriteAttributeString(@"to", Request.To);
writer.WriteAttributeString(@"from", Request.From);
}
writer.WriteAttributeString(@"reasonPhrase", Common.ToString(ReasonPhrase));
if (CredentialsResponses != null)
foreach (var credentialsResponse in CredentialsResponses)
credentialsResponse.Generate(writer);
writer.WriteEndElement();
}
示例4: WriteXml
/// <summary>
/// Writes the configuration section values as an XML element to an <see cref="XmlWriter"/>.
/// </summary>
/// <param name="writer">The <see cref="XmlWriter"/> that writes to the configuration source.</param>
public void WriteXml(XmlWriter writer)
{
if (writer == null) throw new ArgumentNullException("writer");
String serialized = SerializeSection(this, "SerializableConfigurationSection", ConfigurationSaveMode.Full);
writer.WriteRaw(serialized);
}
示例5: WriteElement
private void WriteElement(XNode node, XmlWriter writer)
{
writer.WriteStartElement(node.Name);
foreach (var attr in node.Attributes)
{
if (attr.Match == MatchType.Change || attr.Match == MatchType.NoMatch)
writer.WriteAttributeString(attr.Name, attr.XmlNode.Value);
}
foreach (var text in node.Texts)
{
if (text.Match == MatchType.Change || text.Match == MatchType.NoMatch)
writer.WriteValue(text.XmlNode.Value);
}
foreach (var element in node.Elements)
{
if (element.Match == MatchType.Change)
WriteElement(element, writer);
if (element.Match == MatchType.NoMatch)
writer.WriteRaw(element.XmlNode.OuterXml);
}
writer.WriteEndElement();
}
示例6: SaveValue
internal override void SaveValue (XmlWriter writer)
{
base.SaveValue (writer);
SaveAttribute (writer, "Evaluate", Evaluate);
if (!string.IsNullOrWhiteSpace (TaskBody))
writer.WriteRaw (TaskBody);
}
示例7: Generate
public override void Generate(XmlWriter writer1)
{
this.writer.Flush();
this.writer.Close();
writer1.WriteRaw(output.ToString());
}
示例8: GetType
/// <summary>
/// Converts an object into its XML representation.
/// </summary>
/// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the object is serialized.</param>
void IXmlSerializable.WriteXml(XmlWriter writer)
{
var type = GetType();
var element = new XElement(type.Name);
var serializer = SerializationFactory.GetXmlSerializer();
serializer.Serialize(this, new XmlSerializationContextInfo(element, this));
// The serializer gives us the full element, but we only need the actual content. According to
// http://stackoverflow.com/questions/3793/best-way-to-get-innerxml-of-an-xelement, this method is the fastest:
var reader = element.CreateReader();
reader.MoveToContent();
// CTL-710: fix attributes on top level elements
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
var attributePrefix = reader.Prefix;
var attributeLocalName = reader.LocalName;
var attributeNs = reader.NamespaceURI;
var attributeValue = reader.Value;
writer.WriteAttributeString(attributePrefix, attributeLocalName, attributeNs, attributeValue);
}
reader.MoveToElement();
}
var elementContent = reader.ReadInnerXml();
writer.WriteRaw(elementContent);
}
示例9: AddEntry
private void AddEntry(XmlWriter writer, Package package, string baseUrl)
{
writer.WriteStartElement("entry");
writer.WriteElementString("id", package.ID);
writer.WriteStartElement("title");
writer.WriteAttributeString("type", "text");
writer.WriteValue(package.Name);
writer.WriteEndElement(); // title
writer.WriteStartElement("link");
writer.WriteAttributeString("rel", "alternate");
writer.WriteAttributeString("href", baseUrl + "/extensions/" + package.ID + "/extension.vsix");
writer.WriteEndElement(); // link
writer.WriteStartElement("summary");
writer.WriteAttributeString("type", "text");
writer.WriteValue(package.Description);
writer.WriteEndElement(); // summary
writer.WriteElementString("published", package.DatePublished.ToString("yyyy-MM-ddTHH:mm:ssZ"));
writer.WriteElementString("updated", package.DatePublished.ToString("yyyy-MM-ddTHH:mm:ssZ"));
writer.WriteStartElement("author");
writer.WriteElementString("name", package.Author);
writer.WriteEndElement(); // author
writer.WriteStartElement("content");
writer.WriteAttributeString("type", "application/octet-stream");
writer.WriteAttributeString("src", baseUrl + "/extensions/" + package.ID + "/extension.vsix");
writer.WriteEndElement(); // content
writer.WriteRaw("\r\n<Vsix xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://schemas.microsoft.com/developer/vsx-syndication-schema/2010\">\r\n");
writer.WriteElementString("Id", package.ID);
writer.WriteElementString("Version", package.Version);
writer.WriteStartElement("References");
writer.WriteEndElement();
writer.WriteRaw("</Vsix>");// Vsix
writer.WriteEndElement(); // entry
}
示例10: Write
private void Write(IRssSource src, XmlWriter writer)
{
if (src.IsRetranslator)
{
writer.WriteRaw(src.GetRaw());
}
else{
writeEmbeded(src, writer);
}
}
示例11: WriteXml
/// <summary>
/// Serializes the configuration section into XML and writes to an XML writer object.
/// </summary>
/// <param name="writer">The XML writer object.</param>
public virtual void WriteXml(XmlWriter writer)
{
if (writer == null)
{
throw new ArgumentNullException("writer");
}
var serializedSection = SerializeSection(this, GetConfigurationSectionName(), ConfigurationSaveMode.Full);
writer.WriteRaw(serializedSection);
}
示例12: generateXml
private void generateXml(XmlWriter writer)
{
writer.WriteStartDocument();
writer.WriteStartElement("results");
foreach (var runner in _results.GroupBy(x => x.Runner))
{
writer.WriteStartElement("runner");
writer.WriteAttributeString("id", runner.Key);
foreach (var assembly in runner.GroupBy(x => x.Assembly))
{
writer.WriteStartElement("assembly");
writer.WriteAttributeString("name", assembly.Key);
foreach (var fixture in assembly.GroupBy(x => x.TestFixture))
{
writer.WriteStartElement("fixture");
writer.WriteAttributeString("name", fixture.Key);
foreach (var test in fixture)
{
writer.WriteStartElement("test");
writer.WriteAttributeString("state", test.State.ToString());
writer.WriteAttributeString("name", test.TestName);
if (test.TestDisplayName != null)
writer.WriteAttributeString("displayName", test.TestDisplayName);
writer.WriteAttributeString("duration", test.DurationInMilliseconds.ToString());
writer.WriteStartElement("message");
writer.WriteCData(test.Message);
writer.WriteEndElement();
if (test.State == TestState.Failed || test.State == TestState.Ignored)
{
writer.WriteStartElement("stack-trace");
foreach (var line in test.StackLines)
{
writer.WriteStartElement("line");
writer.WriteStartElement("method");
writer.WriteCData(line.Method);
writer.WriteEndElement();
writer.WriteStartElement("file");
writer.WriteAttributeString("line", line.Line.ToString());
writer.WriteRaw(line.File);
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteEndElement();
}
writer.WriteEndElement();
}
writer.WriteEndElement();
}
writer.WriteEndElement();
}
writer.WriteEndElement();
}
writer.WriteEndElement();
}
示例13: WriteContentsTo
protected override void WriteContentsTo(XmlWriter writer)
{
string data = this.text ?? string.Empty;
if (this.textKind == TextSyndicationContentKind.XHtml)
{
writer.WriteRaw(data);
}
else
{
writer.WriteString(data);
}
}
示例14: buildXml
public void buildXml(XmlWriter xmlWriter)
{
xmlWriter.WriteStartElement("eventDate");
foreach (DateTime item in eventDates_)
{
//xmlWriter.WriteRaw(item.buildXml().ToString());
xmlWriter.WriteRaw("Not implemented");
}
xmlWriter.WriteEndElement();
}
示例15: buildXml
public void buildXml(XmlWriter xmlWriter)
{
xmlWriter.WriteStartElement("functionEvents");
foreach (EventFunctionMModel item in eventFunctionMList_)
{
item.buildXml(xmlWriter);
}
xmlWriter.WriteRaw(jointFunctionEventModel_.buildXml().ToString());
xmlWriter.WriteEndElement();
}