/// <inheritdoc/> public void WriteToXmlStream( XmlStreamWriter writer) { var wpNs = FXNsRef.FromName("wp"); writer.WriteStartElement(wpNs, "category") .WriteInlineCDataElement(wpNs, "cat_name", CategoryName) .WriteInlineCDataElement(wpNs, "category_nicename", CategoryNiceName) .WriteInlineElement(wpNs, "category_parent", "0") .WriteEndElement(); }
/// <inheritdoc /> public void WriteToXmlStream( XmlStreamWriter writer) { var wpNs = FXNsRef.FromName("wp"); writer.WriteStartElement(wpNs, "tag") .WriteInlineElement(wpNs, "term_id", WPTermID.ToString()) .WriteInlineCDataElement(wpNs, "tag_slug", HtmlEncodedTagName) .WriteInlineCDataElement(wpNs, "tag_name", TagFriendlyName) .WriteEndElement(); }
/// <inheritdoc /> public void WriteToXmlStream( XmlStreamWriter writer) { var wpNs = FXNsRef.FromName("wp"); writer.WriteStartElement(wpNs, "author") .WriteInlineElement(wpNs, "author_id", AuthorID.ToString()) .WriteInlineElement(wpNs, "author_login", Login) .WriteInlineElement(wpNs, "author_email", Email) .WriteInlineCDataElement(wpNs, "author_display_name", DisplayName) .WriteInlineElement(wpNs, "author_first_name", FirstName) .WriteInlineElement(wpNs, "author_last_name", LastName) .WriteEndElement(); }
public static void XmlGen() { var outputFilePath = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.Desktop)).FullName + $@"\XmlGenTest6.xml"; var outputFileInfo = new FileInfo(outputFilePath); using var consoleStreamWriter = new ConsoleStreamWriter( outputFileInfo.FullName, false); var writer = new XmlStreamWriter(consoleStreamWriter); writer.WithDeclaration(FXDeclaration.Get(_xmlVersion, "utf-8")) .WithNamespace(excerptNs) .WithNamespace(contentNs) .WithNamespace(wfwNs) .WithNamespace(dcNs) .WithNamespace(wpNs); writer.WriteStartElement("rss") .WriteStartElement("channel") .WriteInlineElement(wpNs, "wxr_version", $"{_wxrVersion:0.0}"); foreach (var tag in WPTerm.AllTags) { tag.WriteToXmlStream(writer); } foreach (var category in WPCategory.AllCategories) { category.WriteToXmlStream(writer); } foreach (var category in WPCategory.AllCategories) { writer.WriteStartElement(wpNs, "category") .WriteInlineCDataElement(wpNs, "cat_name", category.CategoryName) .WriteInlineCDataElement(wpNs, "category_nicename", category.CategoryNiceName) .WriteInlineElement(wpNs, "category_parent", "0") .WriteEndElement(); } writer.WriteEndElement() .WriteEndElement(); }
/// <inheritdoc /> public void WriteToXmlStream( XmlStreamWriter writer) { var wpNs = FXNsRef.FromName("wp"); var commentDateStr = CommentDate.ToString("yyyy-MM-dd HH:mm:ss"); var gmtCommentDateStr = CommentDateGMT.ToString("yyyy-MM-dd HH:mm:ss"); writer.WriteStartElement(wpNs, "comment") .WriteInlineElement(wpNs, "comment_id", CommentId.ToString()) .WriteInlineElement(wpNs, "comment_approved", "1") .WriteInlineElement(wpNs, "comment_author_email", AuthorEmail) .WriteInlineCDataElement(wpNs, "comment_author", Author) .WriteInlineElement(wpNs, "comment_author_url", "") .WriteInlineElement(wpNs, "comment_author_IP", AuthorIP) .WriteInlineElement(wpNs, "comment_date", commentDateStr) .WriteInlineElement(wpNs, "comment_date_gmt", gmtCommentDateStr) .WriteInlineCDataElement(wpNs, "comment_content", Content) .WriteInlineElement(wpNs, "comment_type", "") .WriteInlineElement(wpNs, "comment_parent", ParentId.ToString()); writer.WriteEndElement(); }