Atom Syndication Format
The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol (AtomPub or APP) is a simple HTTP-based protocol for creating and updating web resources.
NuGet Package ID | LiquidTechnologies.XmlObjects.Atom2005 |
---|---|
Description | An object model for the Atom 2005 standard providing strongly typed classes that can be serialized/deserializsed to XML. |
Documentation | Liquid XML Objects API |
Schema Documentation | https://schemas.liquid-technologies.com/W3C/Atom/2005/ |
Official Schema Site | https://www.w3.org/2005/Atom |
License | EULA |
Supported Platforms |
|
The following code shows how to create an XML document using the W3C-Atom nuget.
First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.
using System; using System.Numerics; using System.IO; using System.Text; using LiquidTechnologies.XmlObjects; using LiquidTechnologies.XmlObjects.Atom2005; using System.Xml.Linq; using LiquidTechnologies.XmlObjects; namespace LiquidTechnologies.Samples { public class XmlGeneratorSample { public static string CreateXml() { #region Writing var feedElm = new Atom.FeedElm(); var authors = new Atom.AtomPersonConstructCt(); { authors.Name = "Liquid Technologies"; authors.Uri = "http://www.blogger.com/profile/05443731790392835801"; authors.Email = "noreply@blogger.com"; feedElm.Authors.Add(authors); } var categories = new Atom.CategoryElm(); { categories.Term = "XML"; feedElm.Categories.Add(categories); } var categories1 = new Atom.CategoryElm(); { categories1.Term = "XML Data Binding"; feedElm.Categories.Add(categories1); } var categories2 = new Atom.CategoryElm(); { categories2.Term = "XML Schema"; feedElm.Categories.Add(categories2); } { feedElm.Generators.Add(new XElement("{http://www.w3.org/2005/Atom}generator", new XAttribute("version", "7.00"), new XAttribute("uri", "http://www.blogger.com"), new XAttribute("xmlns", "http://www.w3.org/2005/Atom"), new XText("Blogger"))); } { feedElm.Ids.Add(new XElement("{http://www.w3.org/2005/Atom}id", new XAttribute("xmlns", "http://www.w3.org/2005/Atom"), new XText("tag:blogger.com,1999:blog-32062210"))); } var subtitles = new Atom.AtomTextConstructCt(); { subtitles.Add(new XAttribute("type", "html")); subtitles.Add(new XText("Liquid XML is the ultimate XML Development and Data Transformation Environment including Graphical XSD Editor, XML Editor, WSDL Editor, XML Diff tool, JSON tools and the worlds most advanced XML Data Binding tool to generate C++, C#, Java, VB .Net and Visual Basic 6 code from your XML Schema (XSD, XDR, DTD).")); feedElm.Subtitles.Add(subtitles); } var titles = new Atom.AtomTextConstructCt(); { titles.Add(new XAttribute("type", "text")); titles.Add(new XText("Liquid Technologies Blog - Liquid XML")); feedElm.Titles.Add(titles); } var updateds = new Atom.AtomDateConstructCt(); { updateds.Value = new LxDateTime(LxDateTimeType.DateTime, 2019, 3, 29, 11, 33, 51, 783, 0, 0, 0, 0); feedElm.Updateds.Add(updateds); } var entries = new Atom.EntryTypeCt(); { var authors1 = new Atom.AtomPersonConstructCt(); { authors1.Name = "Liquid Technologies"; authors1.Uri = "http://www.blogger.com/profile/05443731790392835801"; authors1.Email = "noreply@blogger.com"; entries.Authors.Add(authors1); } var categories3 = new Atom.CategoryElm(); { categories3.Term = "Liquid Studio 2020"; categories3.Scheme = "http://www.blogger.com/atom/ns#"; entries.Categories.Add(categories3); } { entries.Contents.Add(new XElement("{http://www.w3.org/2005/Atom}content", new XAttribute("type", "html"), new XAttribute("xmlns", "http://www.w3.org/2005/Atom"), new XText("Liquid Studio 2020 - 17.0.5<br /><ul><li>Important fix for XML Data Binding Wizard from crash reports<br /></li><li> General Fixes</li></ul>Download a Free Trial:<br /><a href=\"https://www.liquid-technologies.com/trial-download\" target=\"_blank\">https://www.liquid-technologies.com/trial-download</a><br /><br /><br />"))); } { entries.Ids.Add(new XElement("{http://www.w3.org/2005/Atom}id", new XAttribute("xmlns", "http://www.w3.org/2005/Atom"), new XText("tag:blogger.com,1999:blog-32062210.post-9083480706837050129"))); } var publisheds = new Atom.AtomDateConstructCt(); { publisheds.Value = new LxDateTime(LxDateTimeType.DateTime, 2019, 3, 27, 11, 32, 0, 0, 0, 0, 0, 0); entries.Publisheds.Add(publisheds); } var titles1 = new Atom.AtomTextConstructCt(); { titles1.Add(new XAttribute("type", "text")); titles1.Add(new XText("Liquid Studio 2020 v17.0.5")); entries.Titles.Add(titles1); } var updateds1 = new Atom.AtomDateConstructCt(); { updateds1.Value = new LxDateTime(LxDateTimeType.DateTime, 2019, 3, 29, 11, 33, 51, 724, 0, 0, 0, 0); entries.Updateds.Add(updateds1); } feedElm.Entries.Add(entries); } var serializer = new LxSerializer<Atom.FeedElm>(); using (StringWriter writer = new StringWriter()) { serializer.Serialize(writer, feedElm); return writer.ToString(); } #endregion } } }
<?xml version='1.0' encoding='UTF-8'?> <!-- Created with Liquid Studio 2020 (https://www.liquid-technologies.com) --> <feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'> <id>tag:blogger.com,1999:blog-32062210</id> <updated>2019-03-29T11:33:51.783+00:00</updated> <category term="XML"/> <category term="XML Data Binding"/> <category term="XML Schema"/> <title type='text'>Liquid Technologies Blog - Liquid XML</title> <subtitle type='html'>Liquid XML is the ultimate XML Development and Data Transformation Environment including Graphical XSD Editor, XML Editor, WSDL Editor, XML Diff tool, JSON tools and the worlds most advanced XML Data Binding tool to generate C++, C#, Java, VB .Net and Visual Basic 6 code from your XML Schema (XSD, XDR, DTD).</subtitle> <author> <name>Liquid Technologies</name> <uri>http://www.blogger.com/profile/05443731790392835801</uri> <email>noreply@blogger.com</email> </author> <generator version='7.00' uri='http://www.blogger.com'>Blogger</generator> <entry> <id>tag:blogger.com,1999:blog-32062210.post-9083480706837050129</id> <published>2019-03-27T11:32:00.000+00:00</published> <updated>2019-03-29T11:33:51.724+00:00</updated> <category scheme="http://www.blogger.com/atom/ns#" term="Liquid Studio 2020"/> <title type='text'>Liquid Studio 2020 v17.0.5</title> <content type='html'>Liquid Studio 2020 - 17.0.5<br /><ul><li>Important fix for XML Data Binding Wizard from crash reports<br /></li><li> General Fixes</li></ul>Download a Free Trial:<br /><a href="https://www.liquid-technologies.com/trial-download" target="_blank">https://www.liquid-technologies.com/trial-download</a><br /><br /><br /></content> <author> <name>Liquid Technologies</name> <uri>http://www.blogger.com/profile/05443731790392835801</uri> <email>noreply@blogger.com</email> </author> </entry> </feed>
The following code shows how to create an XML document using the W3C-Atom nuget.
First the object is constructed and populated, then the LxSerializer is used to convert the object representation into XML.
using System; using System.Numerics; using System.IO; using System.Text; using LiquidTechnologies.XmlObjects; using LiquidTechnologies.XmlObjects.Atom2005; using System.Xml.Linq; using LiquidTechnologies.XmlObjects; namespace LiquidTechnologies.Samples { public class XmlGeneratorSample { public static string CreateXml() { #region Writing var feedElm = new Atom.FeedElm(); var authors = new Atom.AtomPersonConstructCt(); { authors.Name = "John Doe"; feedElm.Authors.Add(authors); } { feedElm.Ids.Add(new XElement("{http://www.w3.org/2005/Atom}id", new XAttribute("xmlns", "http://www.w3.org/2005/Atom"), new XText("urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"))); } var links = new Atom.LinkElm(); { links.Href = "http://example.org/"; feedElm.Links.Add(links); } var titles = new Atom.AtomTextConstructCt(); { titles.Add(new XText("Example Feed")); feedElm.Titles.Add(titles); } var updateds = new Atom.AtomDateConstructCt(); { updateds.Value = new LxDateTime(LxDateTimeType.DateTime, 2003, 12, 13, 18, 30, 2, 0, 0, 0, true); feedElm.Updateds.Add(updateds); } var entries = new Atom.EntryTypeCt(); { { entries.Ids.Add(new XElement("{http://www.w3.org/2005/Atom}id", new XAttribute("xmlns", "http://www.w3.org/2005/Atom"), new XText("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"))); } var links1 = new Atom.LinkElm(); { links1.Href = "http://example.org/2003/12/13/atom03"; entries.Links.Add(links1); } var summaries = new Atom.AtomTextConstructCt(); { summaries.Add(new XText("Some text.")); entries.Summaries.Add(summaries); } var titles1 = new Atom.AtomTextConstructCt(); { titles1.Add(new XText("Atom-Powered Robots Run Amok")); entries.Titles.Add(titles1); } var updateds1 = new Atom.AtomDateConstructCt(); { updateds1.Value = new LxDateTime(LxDateTimeType.DateTime, 2003, 12, 13, 18, 30, 2, 0, 0, 0, true); entries.Updateds.Add(updateds1); } feedElm.Entries.Add(entries); } var serializer = new LxSerializer<Atom.FeedElm>(); using (StringWriter writer = new StringWriter()) { serializer.Serialize(writer, feedElm); return writer.ToString(); } #endregion } } }
<?xml version="1.0" encoding="utf-8"?> <!-- Created with Liquid Studio 2020 (https://www.liquid-technologies.com) --> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Example Feed</title> <link href="http://example.org/"/> <updated>2003-12-13T18:30:02Z</updated> <author> <name>John Doe</name> </author> <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> <entry> <title>Atom-Powered Robots Run Amok</title> <link href="http://example.org/2003/12/13/atom03"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <summary>Some text.</summary> </entry> </feed>
Video Tutorial
This video tutorial demonstrates the basic usage of the XML Objects tool, showing how to generate code from an XSD, read an XML document into the object model, modify the data and write out the XML.