Non-escaped Atom Entry Content

Topics: Argotic.Core
Sep 16, 2008 at 5:09 PM
I've just started using Argotic, and I'm enjoying the experience very much.  I did run into an issue though, with serializing AtomEntry.Content via AtomFeed.Save() or AtomEntry.Save():

By using XmlWriter.WriteString() in the implementation of AtomContent.WriteTo(), the AtomContent.Content is HTML-escaped (e.g. turning < into &lt;), as described in MSDN (, but if the type is an XML type like "application/xml" (which I believe is legal according to section of RFC 4287) I believe it should not be.

As an example, I expect this:

<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="">
  <title>Example Feed</title>
  <link href=""/>
    <name>John Doe</name>
    <title>Atom-Powered Robots Run Amok</title>
    <link href=""/>
    <content type="application/xml">
      <warning xmlns="">
        <run>for the hills!</run>

but get:
<content type="application/xml">
  &lt;warning xmlns=""&gt;&lt;run%gt;for the hills!%lt;/run%gt;&lt;/warning&gt;

Thanks for all the great work!

Sep 16, 2008 at 6:57 PM
I am glad you are finding Argotic useful. I am hoping to have more free time to fix some critical issues like this one. If you would create/open an issue in the issue tracker with some simple repro steps, I will try to get a fix for this issue in the next minor release of the framework. Thank you for taking the time to bring this issue to my attention, I appreciate it.
Sep 16, 2008 at 8:53 PM
I created work item #11319.  Thanks for a great library!
Sep 23, 2008 at 9:32 AM
Hi David,
I've come across your issue report.

I appreciate that the code probably needs to include some checking to establish which output format is required, but do you happen to know the correct MS class to use as a writer when xml is specified?

This would certainly help Oppositional along, but I expect to face the problem you described in coming weeks, and would like to have a go at a patch when the occasion arises.
Sep 23, 2008 at 4:27 PM
Hi Ian, 

I've been told to take a look at WriteRaw, but I haven't looked into it any further.  It seems to me that WriteNode might also be interesting.

I think the real trick is not just the writing of unescaped data (and don't forget reading!) but being good about following the rules laid out in section of the RFC.  If I'm reading it correctly, a type of "text/xml" should be treated as text, but "application/xml" should be treated as XML, etc.

Sep 23, 2008 at 4:55 PM
David and Ian,

I have added both of you as contributors to the project, so if you are so inclined, feel free to implement a fix. I am hoping to be able to dive into working on reported issue starting in October. I apprecaite the feedback and discussions you have been providing.