Hi all,

I want to write a preprocessor in Ruby to hande input of the form:

<math xmlns="http://www.w3.org/1998/Math/MathML"; id="1.1.5.1.1.3">
     <mtext id="1.1.5.1.1.3">
         <neg id="1.1.5.1.1.3#0"/>
         <exists id="1.1.5.1.1.3#1"/>x x<in id="1.1.5.1.1.3#4"/>
         <emptyset id="1.1.5.1.1.3#5"/>
     </mtext>
</math>

I would like to remove the namespace declaration and convert the  
elements within mtext to the corresponding Unicode characters. As the  
elements are *not* actually MathML, will probably need to construct  
the translation table myself, like so:

tr = {
  "exists" => "2203",
  "in" => "2208",
  ...
}

I think I can use the definitions given here (and change the names  
where necessary): http://www.w3.org/TR/REC-html40/sgml/ 
entities.html#h-24.3.1

Is there a way to read the input file into a DOM tree and modify it  
in place, or do I have to traverse it an build a new tree along the way?

Many thanks in advance for any pointers!

Nickolay
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to