XML data format

Specification

The XML format by which mathematical expressions are internally represented is specified as follows:

Example: x+1

The simple expression x+1 is represented as:

<m>
  <e>x+1</e>
</m>

Example: sin(x)

sin(x) is represented as:

<m>
  <e></e>
  <f>
    <b p="latex">\sin\left(<r ref="1"/>\right)</b>
    <b p="text">sin(<r ref="1"/>)</b>
    <c><e>x</e></c>
  </f>
  <e></e>
</m>

Example: sqrt(x+1)

The square root of x+1 is:

<m>
  <e></e>
  <f>
    <b p="latex">\sqrt{<r ref="1"/>}</b>
    <b p="text">sqrt(<r ref="1"/>)</b>
    <c><e>x+1</e></c>
  </f>
  <e></e>
</m>

Example: 1+(1-x)/sin(x)

1+(1-x)/sin(x) would be represented as:

<m>
  <e>1+</e>
  <f>
    <b p="latex">\dfrac{<r ref="1"/>}{<r ref="2"/>}</b>
    <b p="small_latex">\frac{<r ref="1"/>}{<r ref="2"/>}</b>
    <b p="text">(<r ref="1"/>)/(<r ref="2"/>)</b>
    <c up="1" down="2" name="numerator"><e>1-x</e></c>
    <c up="1" down="2" name="denominator">
      <e></e>
      <f>
        <b p="latex">\sin\left(<r ref="1"/>\right)</b>
        <b p="text">sin(<r ref="1"/>)</b>
        <c><e>x</e></c>
      </f>
      <e></e>
    </c>
  </f>
  <e></e>
</m>

Example: Matrix

The 2x3 matrix [1, 2, 3; x, y, z] would be represented by:

<m>
  <e></e>
  <f type="matrix" group="array">
    <b p="latex">\left(\begin{matrix} <r ref="1" d="2" sep0=" &amp; " sep1="\\"/> \end{matrix}\right)</b>
    <b p="text">matrix(<r ref="1" d="2" sep0="," sep1=";"/>)</b>
    <l s="2">
      <l s="3">
        <c><e>1</e></c>
    <c><e>2</e></c>
    <c><e>3</e></c>
      </l>
      <l s="3">
        <c><e>x</e></c>
    <c><e>y</e></c>
    <c><e>z</e></c>
      </l>
    </l>
  </f>
  <e></e>
</m>