{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "chem-bla-ics",
  "description": "Chemblaics (pronounced chem-bla-ics) is the science that uses open science and computers to solve problems in chemistry, biochemistry and related fields.",
  "home_page_url": "https://chem-bla-ics.linkedchemistry.info/",
  "feed_url": "https://chem-bla-ics.linkedchemistry.info/2008/12/30/editing-and-validation-of-cml-documents.json",
  "icon": "https://chem-bla-ics.linkedchemistry.info/assets/images/chem-bla-ics_logo.png",
  "language": "en",
  "authors": [
    {
      "name": "Egon Willighagen",
      "url": "https://orcid.org/0000-0001-7542-0286",
      "_orcid": "0000-0001-7542-0286"
    }
  ],
  "items": [

    {
      "id": "https://doi.org/10.59350/ms0pq-arf10",
      "url": "https://chem-bla-ics.linkedchemistry.info/2008/12/30/editing-and-validation-of-cml-documents.html",
      "title": "Editing and Validation of CML documents in Bioclipse",
      "content_html": "<p>One advantage of using XML is that one can rely on good support in libraries for functionality. When\nparsing XML, one does not have to take care of the syntax, and focus on the data and its semantics.\nThis comes at the expense of verbosity, though, but having the ability to express semantics explicitly\nis a huge benefit for flexibility.</p>\n\n<p>So, when <a href=\"http://wwmm.ch.cam.ac.uk/blogs/murrayrust/\">Peter</a> and Henry put their first documents online about the Chemical Markup Language\n(CML), I was thrilled, even though is actually was still SGML when I encountered it. The work predates the\n<a href=\"http://www.w3.org/TR/1998/REC-xml-19980210\">XML recommendation</a>. As I\n<a href=\"https://chem-bla-ics.linkedchemistry.info/2008/10/02/jchempaint-history-cml-patches-in-1999.html\">recently blogged <i class=\"fa-solid fa-recycle fa-xs\"></i></a>, in ‘99\nI wrote patches for Jmol and JChemPaint to support CML, which were published as preprint in the\n<a href=\"http://www.sciencedirect.com/preprintarchive\">Chemical Preprint Server</a> in a paper in 2000 in the\n<a href=\"http://hackberry.trinity.edu/IJC/\">Internet Journal of Chemistry</a>. Neither of the two has survived.</p>\n\n<p>Anyway, the <a href=\"http://cdk.sf.net/\">Chemistry Development Kit</a> makes heavy use of CML, and \n<a href=\"http://www.bioclipse.net/\">Bioclipse</a> supports it too. Now, Bioclipse is based on the <a href=\"http://www.eclipse.org/\">Eclipse</a>\n<a href=\"http://wiki.eclipse.org/index.php/Rich_Client_Platform\">Rich Client Platform</a> architecture, for which\nthere exist quite a few XML tools in the <a href=\"http://www.eclipse.org/webtools/\">Web Tools Platform</a> (WTP).\nAmong these, a validation, content assisting XML editor. This means, I get red markings when I make my\nXML document not-well-formed or invalid. Just a quick recap: well-formedness means that the XML document\nhas a proper syntax: one root node, properly closed tags, quotes around attribute values, etc. Validness,\nhowever, means that the document is well-formed, but also hierarchically organized according to some specification.</p>\n\n<p>Enter CML. CML is such a specification, first with DTDs, but after the introduction of XML Namespaces with\nXML Schema (see <a href=\"http://cmlexplained.blogspot.com/2007/06/there-can-be-only-one-namespace.html\">There can be only one (namespace)</a>).\nThe WTP can use this XML Schema for validation, and this is of great help learning the CML language.\nPressing Ctrl-space in Bioclipse will now show you what allowed content can be added at the current character\nposition.</p>\n\n<p>Yes, Bioclipse can do this now (in SVN, at least). This has been on my wishlist for at least two years now, but\nnever really found the right information. Now, three days ago <a href=\"http://intellectualcramps.blogspot.com/\">David</a>\nwrote about <a href=\"http://intellectualcramps.blogspot.com/2008/12/end-of-year-cramps.html\">End of Year Cramps</a>\nin which he describes some of his work on the WTP for autocomplete for XPath queries. He <em>see[s] a brighter\nfuture for XML at eclipse over the next year. I hope that those in the eclipse and XML community will help\nto continue to improve the basic support, so that first class commercial quality applications that leverage\nthis support can continue to be built.</em></p>\n\n<p>That was enough statement for me to <a href=\"http://intellectualcramps.blogspot.com/2008/12/end-of-year-cramps.html?showComment=1230451020000#c4332753586396921531\">ask in the comments</a>\non how to make the WTP XML editor aware of the CML XML Schema. It already picked up XML Schema’s with\n<code class=\"language-plaintext highlighter-rouge\">xsi:schemaLocation</code>, but I needed something to worked without such statements in the XML document itself.\nDavid explained that me that I could use the <a href=\"http://intellectualcramps.blogspot.com/2008/12/end-of-year-cramps.html?showComment=1230498780000#c4628316622126916885\">org.eclipse.wst.xml.catalog extension</a>.\nThis was really easy, and <a href=\"http://bioclipse.svn.sourceforge.net/viewvc/bioclipse/bioclipse2/trunk/plugins/net.bioclipse.cml/plugin.xml?r1=8101&amp;r2=8100&amp;pathrev=8101\">commited to Bioclipse SVN</a> as:</p>\n\n<div class=\"language-xml highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nt\">&lt;extension</span>\n  <span class=\"na\">point=</span><span class=\"s\">\"org.eclipse.wst.xml.core.catalogContributions\"</span><span class=\"nt\">&gt;</span>\n  <span class=\"nt\">&lt;catalogContribution&gt;</span>\n    <span class=\"nt\">&lt;uri</span> <span class=\"na\">name=</span><span class=\"s\">\"http://www.xml-cml.org/schema\"</span>\n          <span class=\"na\">uri=</span><span class=\"s\">\"schema24/schema.xsd\"</span><span class=\"nt\">/&gt;</span>\n  <span class=\"nt\">&lt;/catalogContribution&gt;</span>\n<span class=\"nt\">&lt;/extension&gt;</span>\n</code></pre></div></div>\n\n<p>However, that does not make the WTP XML editor available in the Bioclipse application yet. Not ever in\nthe “Open With”… So, I set up a <a href=\"http://bioclipse.svn.sourceforge.net/viewvc/bioclipse/bioclipse2/trunk/features/net.bioclipse.cml_feature/\">CML Feature</a>.\nAfter a follow up question, it turned out that the CML content type of Bioclipse was already a sub type of the\nXML type (see ):</p>\n\n<div class=\"language-xml highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nt\">&lt;extension</span>\n  <span class=\"na\">point=</span><span class=\"s\">\"org.eclipse.core.runtime.contentTypes\"</span><span class=\"nt\">&gt;</span>\n  <span class=\"nt\">&lt;content-type</span>\n    <span class=\"na\">base-type=</span><span class=\"s\">\"org.eclipse.core.runtime.xml\"</span>\n    <span class=\"na\">id=</span><span class=\"s\">\"net.bioclipse.contenttypes.cml\"</span>\n    <span class=\"na\">name=</span><span class=\"s\">\"Chemical Markup Language (CML)\"</span>\n    <span class=\"na\">file-extensions=</span><span class=\"s\">\"cml,xml\"</span>\n    <span class=\"na\">priority=</span><span class=\"s\">\"normal\"</span><span class=\"nt\">&gt;</span>\n  <span class=\"nt\">&lt;/content-type&gt;</span>\n<span class=\"nt\">&lt;/extension&gt;</span>\n</code></pre></div></div>\n\n<p>So, the only remaining problem was to actually get the WTP XML editor as part of the Bioclipse application.\nThe new CML Feature takes care of that (I hope the export and building the update site work too, but\nthat’s yet untested), by important the relevant plugins and features. Last night, however, I ended up with\none stacktrace which gave me little clue on which plugin I was still missing.</p>\n\n<p>Therefore, I headed to #eclipse and actually met David of the blog that started this again. He asked\n<a href=\"http://nitind.blogspot.com/\">nitind</a> to think about it too, and they helped me pin down the issue.\nThis relevant bit of the stacktrace turned out to be:</p>\n\n<div class=\"language-plaintext highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code>Caused by: java.lang.IllegalStateException\n at org.eclipse.core.runtime.Platform.getPluginRegistry(Platform.java:774)\n at org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry$ResourceFactoryRegistryReader.(WTPResourceFactoryRegistry.java:275)\n at org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry.(WTPResourceFactoryRegistry.java:61)\n at org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry.(WTPResourceFactoryRegistry.java:55)\n ... 37 more\n</code></pre></div></div>\n\n<p>This refered to this bit of code of Eclipse’ Platform.java:</p>\n\n<div class=\"language-java highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nc\">Bundle</span> <span class=\"n\">compatibility</span> <span class=\"o\">=</span> <span class=\"nc\">InternalPlatform</span><span class=\"o\">.</span><span class=\"na\">getDefault</span><span class=\"o\">()</span>\n  <span class=\"o\">.</span><span class=\"na\">getBundle</span><span class=\"o\">(</span><span class=\"nc\">CompatibilityHelper</span><span class=\"o\">.</span><span class=\"na\">PI_RUNTIME_COMPATIBILITY</span><span class=\"o\">);</span>\n  <span class=\"k\">if</span> <span class=\"o\">(</span><span class=\"n\">compatibility</span> <span class=\"o\">==</span> <span class=\"kc\">null</span><span class=\"o\">)</span>\n    <span class=\"k\">throw</span> <span class=\"k\">new</span> <span class=\"nf\">IllegalStateException</span><span class=\"o\">();</span>\n</code></pre></div></div>\n\n<p>So, the plugin I turned to to have missing was <em>org.eclipse.core.runtime.compatibility</em>. Apparently,\nsome parts of the WTP that the XMLEditor is using, still uses Eclipse2.x technology.</p>\n\n<p><img src=\"/assets/images/cmlValid.png\" alt=\"\" /></p>\n\n<p>This screenshot shows the WTP XMLEditor in action in Bioclipse on a CML file. It shows the document\ncontents with the ‘Design’ tab, which also shows allowed content, as derived from the XML Schema for\nCML. Also, note that the Outline and Properties view automatically come for free, which allows more\ndetail and navigation of the content.</p>\n\n<p><img src=\"/assets/images/cmlContentAssisting.png\" alt=\"\" /></p>\n\n<p>This screenshot shows the ‘Source’ tab for the same file, where I deliberately changed the value of\nthe @id attribute of the first atom. The value does not validate against the regular expression defined\nin the CML schema for @id attribute values. It also shows the content assisting in action. At any\nlocation in the CML file, I can hit Ctrl-Space, and the editor will show me which content I can add\nat that location.</p>\n\n<p>This makes Bioclipse a perfect tool to craft CML documents and learn the language.</p>",
      "summary": "One advantage of using XML is that one can rely on good support in libraries for functionality. When parsing XML, one does not have to take care of the syntax, and focus on the data and its semantics. This comes at the expense of verbosity, though, but having the ability to express semantics explicitly is a huge benefit for flexibility.",
      "image": "https://chem-bla-ics.linkedchemistry.info/assets/images/cmlValid.png",
      "date_published": "2008-12-30T00:10:00+00:00",
      "date_modified": "2025-10-11T00:00:00+00:00",
      "tags": ["cml","bioclipse","xml","cdk"],
      
      
      
      
      
      
        "authors": [ { "name": "Egon Willighagen", "url": "https://orcid.org/0000-0001-7542-0286" } ]
      
    }

  ]
}
