本文整理汇总了C#中System.Xml.XmlWriter.WriteEndDocument方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteEndDocument方法的具体用法?C# XmlWriter.WriteEndDocument怎么用?C# XmlWriter.WriteEndDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteEndDocument方法的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: Minimize
// ----------------------------------------------------------
public void Minimize(Options aOptions, Def aDef)
{
// reader
_reader = new XmlDocument();
_reader.Load(aOptions.inFile);
// writter with write settings
var writterSettings = new XmlWriterSettings();
if (aOptions.prettyPrint) {
writterSettings.Indent = true;
writterSettings.IndentChars = " ";
}
_writer = XmlWriter.Create(aOptions.outFile, writterSettings);
_writer.WriteStartDocument();
ProcessElement(_reader.DocumentElement, aDef);
_writer.WriteEndDocument();
_writer.Close();
// print warnings
foreach(string warning in _warnings) {
Console.WriteLine(warning);
}
}
示例3: Write
public void Write()
{
XmlWriterSettings xmlSetting = new XmlWriterSettings();
xmlSetting.CloseOutput = true;
xmlSetting.Encoding = Encoding.UTF8;
xmlSetting.Indent = true;
xmlSetting.NewLineChars = "\r\n";
wr = XmlWriter.Create(GeneralConfig.AppDataPath + "Questionaries\\" + questionary.Category + ".xml", xmlSetting);
wr.WriteStartDocument();
wr.WriteStartElement("Questionary");
wr.WriteStartAttribute("category");
wr.WriteValue(questionary.Category);
wr.WriteEndAttribute();
wr.WriteStartAttribute("created");
wr.WriteValue(questionary.Created.ToString());
wr.WriteEndAttribute();
wr.WriteStartAttribute("updated");
wr.WriteValue(questionary.Updated.ToString());
wr.WriteEndAttribute();
wr.WriteStartAttribute("template");
wr.WriteValue(questionary.TemplateId);
wr.WriteEndAttribute();
wr.WriteStartElement("Questions");
WriteQuestions();
wr.WriteEndElement();
wr.WriteEndElement();
wr.WriteEndDocument();
wr.Close();
}
示例4: ExecuteResult
public override void ExecuteResult(ControllerContext context)
{
var response = context.HttpContext.Response;
response.ClearContent();
response.ContentType = "text/xml";
response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xml", _exportName));
var settings = new XmlWriterSettings
{
Indent = true,
Encoding = Encoding.UTF8,
ConformanceLevel = ConformanceLevel.Document,
CheckCharacters = true,
NamespaceHandling = NamespaceHandling.OmitDuplicates
};
_writer = XmlWriter.Create(response.OutputStream, settings);
_writer.WriteStartDocument(true);
AddItem(_blob, _rootName, true);
_writer.WriteEndDocument();
_writer.Flush();
_writer = null;
}
示例5: WriteBooksToXml
private static void WriteBooksToXml( XmlWriter writer, List<Book> booklist )
{
writer.WriteStartDocument();
{
writer.WriteStartElement("bdd", "books", NS); //This adds the root element, <bdd:books>.
foreach(Book book in booklist) {
writer.WriteStartElement("bdd", "book", NS); //Adds the element <bdd:book>.
writer.WriteAttributeString("language", NS, book.Language); //Adding attributes to the element we just started.
writer.WriteAttributeString("pages", NS, book.Pages);
{
writer.WriteElementString("title", NS, book.Title);
if(book.Subtitle != "")
writer.WriteElementString("subtitle", NS, book.Subtitle);
if(book.Authors != null)
foreach(string author in book.Authors)
writer.WriteElementString("author", NS, author);
else
writer.WriteElementString("author", NS, book.Author);
writer.WriteElementString("publisher", NS, book.Publisher);
writer.WriteElementString("year", NS, book.Year);
}
writer.WriteEndElement(); //Closes the <bdd:book> element.
}
writer.WriteEndElement(); //Closes the <bdd:books> element.
}
writer.WriteEndDocument();
}
示例6: Serialize
public void Serialize(DbDatabaseMapping databaseMapping, DbProviderInfo providerInfo, XmlWriter xmlWriter)
{
//Contract.Requires(xmlWriter != null);
//Contract.Requires(databaseMapping != null);
//Contract.Requires(providerInfo != null);
Contract.Assert(databaseMapping.Model != null);
Contract.Assert(databaseMapping.Database != null);
_xmlWriter = xmlWriter;
_databaseMapping = databaseMapping;
_version = databaseMapping.Model.Version;
_providerInfo = providerInfo;
_namespace = _version == DataModelVersions.Version3 ? EdmXmlNamespaceV3 : EdmXmlNamespaceV2;
_xmlWriter.WriteStartDocument();
using (Element("Edmx", "Version", string.Format(CultureInfo.InvariantCulture, "{0:F1}", _version)))
{
WriteEdmxRuntime();
WriteEdmxDesigner();
}
_xmlWriter.WriteEndDocument();
_xmlWriter.Flush();
}
示例7: EndXML
// ***************************************************************************
// Beendet an zu schreiben
public static void EndXML(XmlWriter writer)
{
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
示例8: Serialize
public void Serialize(DbDatabaseMapping databaseMapping, XmlWriter xmlWriter)
{
DebugCheck.NotNull(xmlWriter);
DebugCheck.NotNull(databaseMapping);
Debug.Assert(databaseMapping.Model != null);
Debug.Assert(databaseMapping.Database != null);
_xmlWriter = xmlWriter;
_databaseMapping = databaseMapping;
_version = databaseMapping.Model.SchemaVersion;
_namespace = Equals(_version, XmlConstants.EdmVersionForV3)
? EdmXmlNamespaceV3
: (Equals(_version, XmlConstants.EdmVersionForV2) ? EdmXmlNamespaceV2 : EdmXmlNamespaceV1);
_xmlWriter.WriteStartDocument();
using (Element("Edmx", "Version", string.Format(CultureInfo.InvariantCulture, "{0:F1}", _version)))
{
WriteEdmxRuntime();
WriteEdmxDesigner();
}
_xmlWriter.WriteEndDocument();
_xmlWriter.Flush();
}
示例9: Write
public void Write(XmlWriter writer)
{
writer.WriteStartDocument();
writer.WriteStartElement("Macro");
writer.WriteAttributeString("Name", "Custom tool");
WriteInputs(writer);
WriteResults(writer);
writer.WriteEndElement();
writer.WriteEndDocument();
}
示例10: WriteXml
public static void WriteXml(XmlWriter writer, Action writeGraph, string version = CurrentVersion)
{
writer.WriteStartDocument();
writer.WriteStartElement(ElementName, Namespace);
writer.WriteAttributeString(VersionAttributeName, version);
writeGraph();
writer.WriteEndElement();
writer.WriteEndDocument();
}
示例11: FinalizeXslStylesheet
private static void FinalizeXslStylesheet(XmlWriter writer)
{
writer.WriteEndElement(); // xsl:for-each
writer.WriteEndElement(); // xsl-template
writer.WriteEndElement(); // xsl:stylesheet
writer.WriteEndDocument();
}
示例12: WriteResponse
/// <summary>
/// Serializes an XML-RPC response to a <see cref="System.Xml.XmlWriter"/>.
/// </summary>
/// <param name="writer">the <see cref="System.Xml.XmlWriter"/> to write</param>
/// <param name="response">the <see cref="LX.EasyWeb.XmlRpc.IXmlRpcResponse"/> to serialize</param>
/// <param name="config">the context configuration</param>
/// <param name="typeSerializerFactory">the <see cref="LX.EasyWeb.XmlRpc.Serializer.ITypeSerializerFactory"/> to get type serializers</param>
/// <exception cref="System.Xml.XmlException">failed writing the response XML</exception>
public void WriteResponse(XmlWriter writer, IXmlRpcResponse response, IXmlRpcStreamRequestConfig config, ITypeSerializerFactory typeSerializerFactory)
{
writer.WriteStartDocument();
writer.WriteStartElement(XmlRpcSpec.METHOD_RESPONSE_TAG);
if (response.Fault == null)
RecursiveTypeSerializer.WriteParams(writer, config, typeSerializerFactory, response.Result);
else
WriteFaultResponse(writer, response.Fault, config, typeSerializerFactory);
writer.WriteEndElement();
writer.WriteEndDocument();
}
示例13: Render
protected override void Render(XmlWriter reportBuilder)
{
reportBuilder.WriteStartDocument();
reportBuilder.WriteStartElement("testsuites");
foreach (var contextByAssembly in ContextsByAssembly)
{
Render(reportBuilder, contextByAssembly.Key, contextByAssembly.Value);
}
reportBuilder.WriteEndElement();
reportBuilder.WriteEndDocument();
}
示例14: Write
public void Write(XmlWriter writer)
{
writer.WriteStartDocument();
writer.WriteStartElement("netreflector");
try
{
WriteTypes(writer);
}
finally
{
writer.WriteEndDocument();
}
}
示例15: WriteDictionary
private static void WriteDictionary(ILocalizationDictionary dictionary, XmlWriter writer) {
writer.WriteStartDocument();
var typedDictionary = dictionary as LocalizationDictionary;
if(typedDictionary!=null) {
WriteIncludes(typedDictionary, writer);
}
writer.WriteStartElement("dictionary");
foreach(var key in dictionary.Keys) {
WriteKey(key, dictionary, writer);
}
writer.WriteEndElement();
writer.WriteEndDocument();
}