Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

MathML->SymbolicXML->MathML

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61930] MathML->SymbolicXML->MathML
  • From: "Steven T. Hatton" <hattons at globalsymmetry.com>
  • Date: Sat, 5 Nov 2005 01:52:12 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

The SymbolicXML show in the command below came from xhtml I imported using
XML`Parser`XMLGet[file].  The xhtml has MathML elements which import well.
I want to use these in DocBook, which means I need to qualify the tags with
mml:.  Mathematica has a nice feature for doing this, so I figured I would
import the xhtml, copy the MathML elements in SymbolicXML, and export them. 
If I try to export as MathML, strange things happen.  It treats the
Symbolic XML as unevaluated expressions.  I can export it as XML, but it
seems like I should be able to export a block of SymbolicXML as MathML.  I
have problems whether I exclude the actual <math/> element or not.  Is
there a way to treat SymbolicXML as MathML?

ExportString[ 
  XMLElement[
    "math", {{"http://www.w3.org/2000/xmlns/";, "xmlns"} -> 
        "http://www.w3.org/1998/Math/MathML"},
    {XMLElement[
        "mtable", {"columnalign" -> "left left center center left", 
          "rowlines" -> "solid none"}, {XMLElement[
            "mtr", {}, {XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"Formal Name"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"Name"}]}], 
              XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"Mathematical"}]}], 
              XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"Programming"}]}], 
              XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"Circuitry"}]}]}], 
          XMLElement[
            "mtr", {}, {XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"Negation"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"NOT"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"¬"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"!"}]}], 
              XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"inverter"}]}]}], 
          XMLElement[
            "mtr", {}, {XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"Conjunction"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"AND"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"\[And]"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"&&"}]}], 
              XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"and gate"}]}]}], 
          XMLElement[
            "mtr", {}, {XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"Disjunction"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"OR"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"\[Or]"}]}], 
              XMLElement["mtd", {}, {XMLElement["mtext", {}, {"||"}]}], 
              XMLElement[
                "mtd", {}, {XMLElement["mtext", {}, {"or gate"}]}]}]}]}],
  "XML",
  ConversionOptions -> {
      "NamespacePrefixes" -> {"http://www.w3.org/1998/Math/MathML"; ->
"mml"},
      "Entities" -> {"MathML",
          "\[Implies]" -> "&Implies;",
          "\[SuchThat]" -> "&SuchThat;"
          }}]
-- 
"Philosophy is written in this grand book, The Universe. ... But the book
cannot be understood unless one first learns to comprehend the language...
in which it is written. It is written in the language of mathematics, ...;
without which wanders about in a dark labyrinth."   The Lion of Gaul


  • Prev by Date: Re: Use of Mathematica with Rule-based Equation Derivations
  • Next by Date: Re: Use of Mathematica with Rule-based Equation Derivations
  • Previous by thread: Re: GraphicsArray ---> DisplayTogether?
  • Next by thread: En:Re:String filtering problem