« Real world SQL injection attacks | Main

MathML is aweful!

I knew about MathML for some time now, but I never thought it was this bad. See, MathML is an XML based markup language used to describe in a standards compliant manner mathematical notations. In principle this is a cool thing, until I saw a real world example from Wolfram Research:

<math xmlns='http://www.w3.org/1998/Math/MathML' mathematica:form='TraditionalForm' xmlns:mathematica='http://www.wolfram.com/XML/'> <semantics> <mrow> <mrow> <msqrt> <mi> z </mi> </msqrt> <mo> &#10869; </mo> <mrow> <munderover> <mo> &#8721; </mo> <mrow> <mi> k </mi> <mo> = </mo> <mn> 0 </mn> </mrow> <mi> &#8734; </mi> </munderover> <mrow> <semantics> <msub> <mrow> <mo> ( </mo> <mrow> <mo> - </mo> <mfrac> <mn> 1 </mn> <mn> 2 </mn> </mfrac> </mrow> <mo> ) </mo> </mrow> <mi> k </mi> </msub> <annotation encoding='Mathematica'> TagBox[SubscriptBox[RowBox[List[&quot;(&quot;, RowBox[List[&quot;-&quot;, FractionBox[&quot;1&quot;, &quot;2&quot;]]], &quot;)&quot;]], &quot;k&quot;], Pochhammer] </annotation> </semantics> <mo> &#8290; </mo> <mfrac> <msup> <mrow> <mo> ( </mo> <mrow> <mn> 1 </mn> <mo> - </mo> <mi> z </mi> </mrow> <mo> ) </mo> </mrow> <mi> k </mi> </msup> <mrow> <mi> k </mi> <mo> ! </mo> </mrow> </mfrac> </mrow> </mrow> </mrow> <mo> /; </mo> <mrow> <mrow> <semantics> <mo> &#10072; </mo> <annotation encoding='Mathematica'> &quot;\[LeftBracketingBar]&quot; </annotation> </semantics> <mrow> <mi> z </mi> <mo> - </mo> <mn> 1 </mn> </mrow> <semantics> <mo> &#10072; </mo> <annotation encoding='Mathematica'> &quot;\[RightBracketingBar]&quot; </annotation> </semantics> </mrow> <mo> &lt; </mo> <mn> 1 </mn> </mrow> </mrow> <annotation-xml encoding='MathML-Content'> <apply> <ci> Condition </ci> <apply> <eq /> <apply> <power /> <ci> z </ci> <cn type='rational'> 1 <sep /> 2 </cn> </apply> <apply> <sum /> <bvar> <ci> k </ci> </bvar> <lowlimit> <cn type='integer'> 0 </cn> </lowlimit> <uplimit> <infinity /> </uplimit> <apply> <times /> <apply> <ci> Pochhammer </ci> <apply> <times /> <cn type='integer'> -1 </cn> <cn type='rational'> 1 <sep /> 2 </cn> </apply> <ci> k </ci> </apply> <apply> <times /> <apply> <power /> <apply> <plus /> <cn type='integer'> 1 </cn> <apply> <times /> <cn type='integer'> -1 </cn> <ci> z </ci> </apply> </apply> <ci> k </ci> </apply> <apply> <power /> <apply> <factorial /> <ci> k </ci> </apply> <cn type='integer'> -1 </cn> </apply> </apply> </apply> </apply> </apply> <apply> <lt /> <apply> <abs /> <apply> <plus /> <ci> z </ci> <cn type='integer'> -1 </cn> </apply> </apply> <cn type='integer'> 1 </cn> </apply> </apply> </annotation-xml> </semantics> </math>

It is awfully complex and verbose! This just reiterates what I held to be true for a long time now - XML is being abused. It is great for moving hierarchical data between disparate systems - even non-hierarchical data if you focus on the interoperability and compatibility it facilitates, however using it as RDBMS storage solutions or this kind of hyper verbose markup is down right a waste of space and time. When will people learn that efficiency is important?

Look at this well known equation (all from the Wikipedia entry):


In LaTeX it looks like this:

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Terse, huh?

Look at MathML:

<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
 <mo>=</mo>
 <mfrac>
  <mrow>
   <mrow>
    <mo>-</mo>
    <mi>b</mi>
   </mrow>
   <mo>&PlusMinus;</mo>
   <msqrt>
    <msup>
     <mi>b</mi>
     <mn>2</mn>
    </msup>
    <mo>-</mo>
    <mrow>
     <mn>4</mn>
     <mo>&InvisibleTimes;</mo>
     <mi>a</mi>
     <mo>&InvisibleTimes;</mo>
     <mi>c</mi>
    </mrow>
   </msqrt>
  </mrow>
  <mrow>
   <mn>2</mn>
   <mo>&InvisibleTimes;</mo>
   <mi>a</mi>
  </mrow>
 </mfrac>
</math>

It is disgusting...

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on August 4, 2008 5:40 PM.

The previous post in this blog was Real world SQL injection attacks.

Many more can be found on the main index page or by looking through the archives.