« Reinventing the Chalkboard | Main | Flash Image Viewer »

mathML reader algorithm

I've been working on a MathML reader, in Flash. As soon as I get a complex fraction to display properly, I'll post an example and maybe the source code.

Here's a sketch of the algorithm I'm using to render MathML in Flash:


  1. Initialize: refer to root node, create "myMath" movieClip (Clip) and assign stage coordinates for myMath

  2. Loop through all nodes in mathML tree, and create nested Clips for each node, attaching node-specific information to each Clip

    • (if a text node, create a text Clip || if not, create an "invisible" clip), with nodeName and ancestry going back two generations in tree

    • If new Clip is for a text node, save the path of this Clip in an array, for later reference

    • determine display rule to apply to Clip, based on node names of parent and grandparent nodes in mathML tree, and save relative position and additional information to this Clip object, and to its parent Clip Object.


  3. Loop through "visible" Clips
    • for each visible Clip, recursively traverse the tree and add the Clip's size to a variable of it's ancestors


  4. recursively loop through all Clip and set positions on stage
    • use relative positioning variables, for each Clip, to determine and set _x and _y values for each character in the math statement.


Comments

i am really interested in your current project, since i was already thinking of doing it myself but due to my exams i am postponing it for a while...

anyways i really would like to be updated of any further achievments you would sieze, so you are welcome to contact me any time...

8-D

Thanks :-)

I'll be making any announcements here on the blog.