IDL Interfaces for MathML DOM

MathML 2.0 Draft Appendix E

E.1

1. Does the Math WG plans to make language-specific bindings (for example, 
Java/ECMAScript, in the spirit of W3C DOM or SMIL DOM) available for 
MathML DOM?

2. The return value of some of the methods for the following interfaces are not 
included in the corresponding IDL definition: 

MathMLvectorElement, MathMLmatrixElement, MathMLmatrixrowElement.

The following is one effort towards creating a single mathml.idl file that works 
(all IDL definitions were aggregated, comments were stripped, necessary 
headers, typedef and interface declarations were added). Both C and Java 
bindings were successfully created using it. It is included here in the hope 
that it will benefit others.

Pankaj Kamthan
--

// File: mathml.idl
#ifndef _MATHML_IDL_
#define _MATHML_IDL_

#include "dom.idl"

#pragma prefix "dom.w3c.org"

module mathml {

  typedef dom::DOMString DOMString;
  typedef dom::Element Element;
  typedef dom::Document Document;
  typedef dom::DOMImplementation DOMImplementation;
  typedef dom::Node Node;
  typedef dom::NodeList NodeList;

  interface MathMLDOMImplementation;
  interface MathMLElement;
  interface MathMLDocumentFragment;
  interface MathMLmathElement;
  interface MathMLSemanticsElement;
  interface MathMLAnnotationElement;
  interface MathMLXMLAnnotationElement;
  interface MathMLPresentationElement;
  interface MathMLCharacterElement;
  interface MathMLGlyphElement;
  interface MathMLSpaceElement;
  interface MathMLPresentationToken;
  interface MathMLOperatorElement;
  interface MathMLStringLitElement;
  interface MathMLPresentationContainer;
  interface MathMLStyleElement;
  interface MathMLPaddedElement;
  interface MathMLFencedElement;
  interface MathMLEncloseElement;
  interface MathMLActionElement;
  interface MathMLFractionElement;
  interface MathMLRadicalElement;
  interface MathMLScriptElement;
  interface MathMLUnderOverElement;
  interface MathMLMultiScriptsElement;
  interface MathMLTableElement;
  interface MathMLTableRowElement;
  interface MathMLLabeledRowElement;
  interface MathMLTableCellElement;
  interface MathMLAlignGroupElement;
  interface MathMLAlignMarkElement;
  interface MathMLContentElement;
  interface MathMLContentToken;
  interface MathMLcnElement;
  interface MathMLciElement;
  interface MathMLcsymbolElement;
  interface MathMLContentContainer;
  interface MathMLapplyElement;
  interface MathMLfnElement;
  interface MathMLlambdaElement;
  interface MathMLsetElement;
  interface MathMLlistElement;
  interface MathMLbvarElement;
  interface MathMLpredefinedSymbol;
  interface MathMLintervalElement;
  interface MathMLconditionElement;
  interface MathMLdeclareElement;
  interface MathMLvectorElement;
  interface MathMLmatrixElement;
  interface MathMLmatrixrowElement;

interface MathMLDOMImplementation: DOMImplementation {
  MathMLmathElement createMathMLmathElement(in Document 
hostDocument, in Node parent);
};

interface MathMLElement: Element {
  attribute DOMString className;
  attribute DOMString style;
  attribute DOMString id;
};

interface MathMLDocumentFragment: MathMLElement {
};

interface MathMLmathElement: MathMLElement {
  readonly attribute MathMLDocumentFragment declarations;
  attribute DOMString macros;
  attribute DOMString display;
  MathMLdeclareElement insertDeclaration(in MathMLdeclareElement 
newDeclaration, in unsigned long index);
  MathMLdeclareElement setDeclaration(in MathMLdeclareElement 
newDeclaration, in unsigned long index);
  MathMLdeclareElement removeDeclaration(in unsigned long index);
  MathMLDocumentFragment createMathMLDocumentFragment();
  MathMLElement createMathMLElement(in DOMString tagName);
};

interface MathMLSemanticsElement: MathMLElement {
  attribute MathMLElement body;
  MathMLElement getAnnotation(in unsigned long index);
  MathMLElement insertAnnotation(in MathMLElement newAnnotation, in 
unsigned long index);
  MathMLElement setAnnotation(in MathMLElement newAnnotation, in 
unsigned long index);
};

interface MathMLAnnotationElement: MathMLElement {
  attribute DOMString body;
  attribute DOMString encoding;
};

interface MathMLXMLAnnotationElement: MathMLElement {
  readonly attribute NodeList contents;
  attribute DOMString encoding;
};

interface MathMLPresentationElement: MathMLElement {
};

interface MathMLCharacterElement: MathMLPresentationElement {
  attribute DOMString name;
};

interface MathMLGlyphElement: MathMLPresentationElement {
  attribute DOMString alt;
  attribute DOMString fontfamily;
  attribute unsigned long index;
};

interface MathMLSpaceElement: MathMLPresentationElement {
  attribute DOMString width;
  attribute DOMString height;
  attribute DOMString depth;
};

interface MathMLPresentationToken: MathMLPresentationElement {
  attribute DOMString fontsize;
  attribute DOMString fontweight;
  attribute DOMString fontstyle;
  attribute DOMString fontfamily;
  attribute DOMString color;
  readonly attribute MathMLDocumentFragment contents;
};

interface MathMLOperatorElement: MathMLPresentationToken {
  attribute DOMString form;
  attribute DOMString fence;
  attribute DOMString separator;
  attribute DOMString lspace;
  attribute DOMString rspace;
  attribute DOMString stretchy;
  attribute DOMString symmetric;
  attribute DOMString maxsize;
  attribute DOMString minsize;
  attribute DOMString largeop;
  attribute DOMString moveablelimits;
  attribute DOMString accent;
};

interface MathMLStringLitElement: MathMLPresentationToken {
  attribute DOMString lquote;
  attribute DOMString rquote;
};

interface MathMLPresentationContainer: MathMLPresentationElement {
  readonly attribute MathMLDocumentFragment arguments;
  MathMLElement getArgument(in unsigned long index);
  MathMLElement insertArgument(in MathMLElement newArgument, in 
unsigned long index);
  MathMLElement setArgument(in MathMLElement newArgument, in unsigned 
long index);
  void deleteArgument(in unsigned long index);
  MathMLElement removeArgument(in unsigned long index);
};

interface MathMLStyleElement: MathMLPresentationContainer {
  attribute DOMString scriptlevel;
  attribute DOMString displaystyle;
  attribute DOMString scriptsizemultiplier;
  attribute DOMString scriptminsize;
  attribute DOMString color;
  attribute DOMString background;
};

interface MathMLPaddedElement: MathMLPresentationContainer {
  attribute DOMString width;
  attribute DOMString lspace;
  attribute DOMString height;
  attribute DOMString depth;
};

interface MathMLFencedElement: MathMLPresentationContainer {
  attribute DOMString open;
  attribute DOMString close;
  attribute DOMString separators;
};

interface MathMLEncloseElement: MathMLPresentationContainer {
  attribute DOMString notation;
};

interface MathMLActionElement: MathMLPresentationContainer {
  attribute DOMString actiontype;
  attribute DOMString selection;
};

interface MathMLFractionElement: MathMLPresentationElement {
  attribute DOMString linethickness;
  attribute MathMLElement numerator;
  attribute MathMLElement denominator;
};

interface MathMLRadicalElement: MathMLPresentationElement {
  attribute MathMLElement radicand;
  attribute MathMLElement index;
};

interface MathMLScriptElement: MathMLPresentationElement {
  attribute DOMString subscriptshift;
  attribute DOMString superscriptshift;
  attribute MathMLElement base;
  attribute MathMLElement subscript;
  attribute MathMLElement superscript;
};

interface MathMLUnderOverElement: MathMLPresentationElement {
  attribute DOMString accentunder;
  attribute DOMString accent;
  attribute MathMLElement base;
  attribute MathMLElement underscript;
  attribute MathMLElement overscript;
};

interface MathMLMultiScriptsElement: MathMLPresentationElement {
  attribute DOMString subscriptshift;
  attribute DOMString superscriptshift;
  attribute MathMLElement base;
  readonly attribute MathMLDocumentFragment prescripts;
  readonly attribute MathMLDocumentFragment scripts;
  readonly attribute unsigned long numprescriptcolumns;
  readonly attribute unsigned long numscriptcolumns;
  MathMLElement getPreSubScript(in unsigned long colIndex);
  MathMLElement getSubScript(in unsigned long colIndex);
  MathMLElement getPreSuperScript(in unsigned long colIndex);
  MathMLElement getSuperScript(in unsigned long colIndex);
  MathMLElement insertPreSubScriptBefore(in unsigned long colIndex, in 
MathMLElement newScript);
  MathMLElement setPreSubScriptAt(in unsigned long colIndex, in 
MathMLElement newScript);
  MathMLElement insertSubScriptBefore(in unsigned long colIndex, in 
MathMLElement newScript);
  MathMLElement setSubScriptAt(in unsigned long colIndex, in 
MathMLElement newScript);
  MathMLElement insertPreSuperScriptBefore(in unsigned long colIndex, in 
MathMLElement newScript);
  MathMLElement setPreSuperScriptAt(in unsigned long colIndex, in 
MathMLElement newScript);
  MathMLElement insertSuperScriptBefore(in unsigned long colIndex, in 
MathMLElement newScript);
  MathMLElement setSuperScriptAt(in unsigned long colIndex, in 
MathMLElement newScript);
};

interface MathMLTableElement: MathMLPresentationElement {
  attribute DOMString align;
  attribute DOMString rowalign;
  attribute DOMString columnalign;
  attribute DOMString groupalign;
  attribute DOMString alignmentscope;
  attribute DOMString columnwidth;
  attribute DOMString width;
  attribute DOMString rowspacing;
  attribute DOMString columnspacing;
  attribute DOMString rowlines;
  attribute DOMString columnlines;
  attribute DOMString frame;
  attribute DOMString framespacing;
  attribute DOMString equalrows;
  attribute DOMString equalcolumns;
  attribute DOMString displaystyle;
  attribute DOMString side;
  attribute DOMString minlabelspacing;
  readonly attribute MathMLDocumentFragment rows;
  MathMLTableRowElement insertEmptyRow(in long index);
  MathMLLabeledRowElement insertEmptyLabeledRow(in long index);
  MathMLTableRowElement getRow(in unsigned long index);
  MathMLTableRowElement insertRow(in long index, in 
MathMLTableRowElement newRow);
  MathMLTableRowElement setRow(in long index, in MathMLTableRowElement 
newRow);
  void deleteRow(in unsigned long index);
  MathMLTableRowElement removeRow(in long index);
};
 
interface MathMLTableRowElement: MathMLPresentationElement {
  attribute DOMString rowalign;
  attribute DOMString columnalign;
  attribute DOMString groupalign;
  readonly attribute MathMLDocumentFragment cells;
  MathMLTableCellElement insertEmptyCell(in unsigned long index);
  MathMLTableCellElement insertCell(in MathMLTableCellElement newCell, in 
unsigned long index);
  MathMLTableCellElement setCell(in MathMLTableCellElement newCell, in 
unsigned long index);
  void deleteCell(in unsigned long index);
};

interface MathMLLabeledRowElement: MathMLTableRowElement {
  attribute MathMLElement label;
};

interface MathMLTableCellElement: MathMLPresentationContainer {
  attribute DOMString rowspan;
  attribute DOMString columnspan;
  attribute DOMString rowalign;
  attribute DOMString columnalign;
  attribute DOMString groupalign;
  readonly attribute boolean hasaligngroups;
  readonly attribute DOMString cellindex;
};

interface MathMLAlignGroupElement: MathMLPresentationElement {
  attribute DOMString groupalign;
};

interface MathMLAlignMarkElement: MathMLPresentationElement {
  attribute DOMString edge;
};

interface MathMLContentElement: MathMLElement {
}; 

interface MathMLContentToken: MathMLContentElement {
  readonly attribute MathMLDocumentFragment arguments;
  Node getArgument(in unsigned long index);
  Node insertArgument(in unsigned long index, in Node newArgument);
  Node setArgument(in unsigned long index, in Node newArgument);
  void deleteArgument(in unsigned long index);
  Node removeArgument(in unsigned long index);
};

interface MathMLcnElement: MathMLContentToken {
  attribute DOMString type;
  attribute DOMString base;
  readonly attribute unsigned long nargs;
  attribute DOMString definitionURL;
  attribute DOMString encoding;
};

interface MathMLciElement: MathMLContentToken {
  attribute DOMString type;
};

interface MathMLcsymbolElement: MathMLContentToken {
  attribute DOMString definitionURL;
  attribute DOMString encoding;
};

interface MathMLContentContainer: MathMLContentElement {
  readonly attribute unsigned long nBoundVariables;
  readonly attribute MathMLDocumentFragment nArguments;
  attribute MathMLconditionElement condition;
  attribute MathMLElement lowLimit;
  attribute MathMLElement upLimit;
  attribute MathMLElement opDegree;
  MathMLElement getArgument(in unsigned long index);
  MathMLElement insertArgument(in MathMLElement newArgument, in 
unsigned long index);
  MathMLElement setArgument(in MathMLElement newArgument, in unsigned 
long index);
  void deleteArgument(in unsigned long index);
  MathMLElement removeArgument(in unsigned long index);
  MathMLbvarElement getBoundVariable(in unsigned long index);
  MathMLbvarElement insertBoundVariable(in MathMLbvarElement newBVar, 
in unsigned long index);
  MathMLbvarElement setBoundVariable(in MathMLbvarElement newBVar, in 
unsigned long index);
  void deleteBoundVariable(in unsigned long index);
  MathMLbvarElement removeBoundVariable(in unsigned long index);
};

interface MathMLapplyElement: MathMLContentContainer {
  attribute MathMLElement operator;
};

interface MathMLfnElement: MathMLContentContainer {
  attribute DOMString definitionURL;
  attribute DOMString encoding;
};

interface MathMLlambdaElement: MathMLContentContainer {
  attribute MathMLElement expression;
};

interface MathMLsetElement: MathMLContentContainer {
  readonly attribute boolean isExplicit;
  attribute DOMString type;
};

interface MathMLlistElement: MathMLContentContainer {
  readonly attribute boolean isExplicit;
  attribute DOMString ordering;
};

interface MathMLbvarElement: MathMLContentContainer {
};

interface MathMLpredefinedSymbol: MathMLContentElement {
  attribute DOMString definitionURL;
  attribute DOMString encoding;
  attribute DOMString arity;
  readonly attribute DOMString symbolName;
};

interface MathMLintervalElement: MathMLContentElement {
  attribute DOMString closure;
  attribute MathMLcnElement start;
  attribute MathMLcnElement end;
};
 
interface MathMLconditionElement: MathMLContentElement {
  attribute MathMLapplyElement condition;
};

interface MathMLdeclareElement: MathMLContentElement {
  attribute DOMString type;
  attribute unsigned long nargs;
  attribute DOMString occurrence;
  attribute DOMString definitionURL;
  attribute DOMString encoding;
  attribute MathMLciElement identifier;
  attribute MathMLElement constructor;
};

interface MathMLvectorElement: MathMLContentElement {
  readonly attribute unsigned long ncomponents;
  MathMLContentElement getComponent(in unsigned long index);
  MathMLContentElement insertComponent(in MathMLContentElement 
newComponent, in unsigned long index);
  MathMLContentElement setComponent(in MathMLContentElement 
newComponent, in unsigned long index);
  void deleteComponent(in unsigned long index);
  MathMLContentElement removeComponent(in unsigned long index);
};
  
interface MathMLmatrixElement: MathMLContentElement {
  readonly attribute unsigned long nrows;
  readonly attribute unsigned long ncols;
  readonly attribute MathMLDocumentFragment rows;
  MathMLmatrixrowElement getRow(in unsigned long index);
  MathMLmatrixrowElement insertRow(in MathMLmatrixrowElement newRow, in 
unsigned long index);
  MathMLmatrixrowElement setRow(in MathMLmatrixrowElement newRow, in 
unsigned long index);
  void deleteRow(in unsigned long index);
  MathMLmatrixrowElement removeRow(in unsigned long index);
};

interface MathMLmatrixrowElement: MathMLContentElement {
  readonly attribute unsigned long nEntries;
  MathMLContentElement getEntry(in unsigned long index);
  MathMLContentElement insertEntry(in MathMLContentElement newEntry, in 
unsigned long index);
  MathMLContentElement setEntry(in MathMLContentElement newEntry, in 
unsigned long index);
  void deleteEntry(in unsigned long index);
  MathMLContentElement removeEntry(in unsigned long index);
};
};

#endif // _MATHML_IDL_

Received on Wednesday, 3 May 2000 16:15:26 UTC