Sandbox:Jmol

From OpenWetWare
Jump to: navigation, search

Inlined CML File

<jmol>

 <jmolApplet>

<size>150</size> <color>red</color>

   <inlineContents><![CDATA[<cml:molecule xmlns:cml="http://www.xml-cml.org/schema/cml2/core" title="chair.mol">

<cml:metadataList title="generated automatically from Openbabel"> <cml:metadata name="dc:creator" content="OpenBabel version 1-100.1"/> <cml:metadata name="dc:description" content="Conversion of legacy filetype to CML"/> <cml:metadata name="dc:identifier" content="Unknown"/> <cml:metadata name="dc:content"/> <cml:metadata name="dc:rights" content="unknown"/> <cml:metadata name="dc:type" content="chemistry"/> <cml:metadata name="dc:contributor" content="unknown"/> <cml:metadata name="dc:creator" content="Openbabel V1-100.1"/> <cml:metadata name="dc:date" content="Tue Jun 06 19:11:23 BST 2006"/> <cml:metadata name="cmlm:structure" content="yes"/> </cml:metadataList> <cml:atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18" elementType="C C C C C C H H H H H H H H H H H H" formalCharge="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" x3="1.688100 2.148400 2.936100 2.092700 1.632900 0.853200 2.580700 1.089700 1.257800 2.779100 3.872500 3.241300 1.200500 2.683500 0.995700 2.524000 0.564200 -0.091900" y3="2.157200 3.621700 3.912600 3.576900 2.112000 1.810200 1.488700 1.971100 4.292700 3.847400 3.305300 4.986100 4.246700 3.770000 1.892800 1.442600 0.732200 2.403900" z3="-3.019300 -2.979700 -1.694200 -0.455700 -0.489800 -1.777800 -3.065200 -3.943000 -3.028200 -3.872700 -1.684400 -1.668500 -0.422400 0.471400 0.400200 -0.429400 -1.803100 -1.787800"/> <cml:bondArray atomRef1="a1 a1 a1 a1 a2 a2 a2 a3 a3 a3 a4 a4 a4 a5 a5 a5 a6 a6" atomRef2="a2 a6 a7 a8 a3 a9 a10 a4 a11 a12 a5 a13 a14 a6 a15 a16 a17 a18" order="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"/> </cml:molecule>]]> </inlineContents>

 </jmolApplet>

</jmol>

This inline example is of a datafile in XML format, but fully carried in a declared namespace of xmlns:cml="http://www.xml-cml.org/schema/cml2/core. In theory, this XML should be processable separately from e.g. the jmol default namespace. Does Mediawiki honour such namespaces?

The next example is the same datafile, but fully escaped.

<jmol>

 <jmolApplet>

<size>150</size> <color>orange</color>

   <inlineContents><![CDATA[<cml:molecule xmlns:cml="http://www.xml-cml.org/schema/cml2/core" title="chair.mol">

<cml:metadataList title="generated automatically from Openbabel"> <cml:metadata name="dc:creator" content="OpenBabel version 1-100.1"/> <cml:metadata name="dc:description" content="Conversion of legacy filetype to CML"/> <cml:metadata name="dc:identifier" content="Unknown"/> <cml:metadata name="dc:content"/> <cml:metadata name="dc:rights" content="unknown"/> <cml:metadata name="dc:type" content="chemistry"/> <cml:metadata name="dc:contributor" content="unknown"/> <cml:metadata name="dc:creator" content="Openbabel V1-100.1"/> <cml:metadata name="dc:date" content="Tue Jun 06 19:11:23 BST 2006"/> <cml:metadata name="cmlm:structure" content="yes"/> </cml:metadataList> <cml:atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18" elementType="C C C C C C H H H H H H H H H H H H" formalCharge="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" x3="1.688100 2.148400 2.936100 2.092700 1.632900 0.853200 2.580700 1.089700 1.257800 2.779100 3.872500 3.241300 1.200500 2.683500 0.995700 2.524000 0.564200 -0.091900" y3="2.157200 3.621700 3.912600 3.576900 2.112000 1.810200 1.488700 1.971100 4.292700 3.847400 3.305300 4.986100 4.246700 3.770000 1.892800 1.442600 0.732200 2.403900" z3="-3.019300 -2.979700 -1.694200 -0.455700 -0.489800 -1.777800 -3.065200 -3.943000 -3.028200 -3.872700 -1.684400 -1.668500 -0.422400 0.471400 0.400200 -0.429400 -1.803100 -1.787800"/> <cml:bondArray atomRef1="a1 a1 a1 a1 a2 a2 a2 a3 a3 a3 a4 a4 a4 a5 a5 a5 a6 a6" atomRef2="a2 a6 a7 a8 a3 a9 a10 a4 a11 a12 a5 a13 a14 a6 a15 a16 a17 a18" order="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"/> </cml:molecule>]]> </inlineContents>

 </jmolApplet>

</jmol>

Both of these examples display if (and only if) the CML contents is put inside <![CDATA[ and ]]> tags.