## Saturday, February 18, 2006

### Blogging chemistry on blogspot.com

You might have read earlier posts in this blog on CMLRSS, and received a question today on how to integrate CMLRSS with blogs on blogspot.com. Now, current CMLRSS feeds are normally generated with customized scripts, often directly from a database.

So, here's my attempt to include CML in a blogspot.com blog. OpenBabel 2.0 can create good CML, for example for acetic acid [1]:

Nothing much to see, right? Well, that's good, because it's inserted as CML, not as anything readable, like this equivalent:
<cml:molecule xmlns:cml="http://www.xml-cml.org/schema/cml2/core"><cml:atomArray atomID="a1 a2 a3 a4" elementType="C C O O" formalCharge="0 0 0 0"/><cml:bondArray atomRef1="a1 a2 a2" atomRef2="a2 a3 a4" order="1 2 1"/></cml:molecule>

1.InChI=1/C2H4O2/c1-2(3)4/h1H3,(H,3,4)

1. I just checked the Atom feed (atom.xml) for this blog item. The CML gets nicely inserted using the appropriate CML namespace. So that's good. One big difference though, is that the CML now is child of the blog item content node, instead of next to it, as in most current CMLRSS feeds. But I'm happy with it! Only the CMLRSS client needs to do is look for CML anywhere in the blog item node :)

2. BTW, keep in mind that if you make CML output in which all data is in attributes, as in the above article, the CML will not show up at all in the visual content of the blog item.

This is good if you want to include a large molecule, or a big reaction mechanism in the blog, and don't want to bother your readers with big CML blobs.

In OpenBabel 1 you can use the -x2an command line option to create such CML. Have not checked it, but OB2 must have a similar option.

3. Hi,

Your rss-feed is incorrect. It contains in the section where the code should be shown "<".

This is incorrect as the feed should be escaped, so in this case, your feed should contain "&lt;" to properly escape the &.

Toma

4. Ignore my previous comment, let me try again ;-)

Your rss-feed is incorrect. It contains in the section where the code should be shown "&lt;".

This is incorrect as the feed should be escaped, so in this case, your feed should contain "&amp;lt;" to properly escape the &.

Toma

5. Hi Toma,

I'm not sure to which section you are referring here... I don't intend to output '<' in the visual output...

I've ran it through an Atom 1.0 validator which, and that one was OK with the CML stuff in the blog...

Additionally I tried a Atom 0.3 validator, but that one just ignored the CML bits...

Egon

6. Arghh... I tried to say:

I did not intend to show '&lt;' in the output, but really '<cml'.

7. These comments have been invaluable to me as is this whole site. I thank you for your comment.

8. Great news! Thank you.

If interested, can visit Home insurance traveler blog.