MathGroup Archive 2005

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

Search the Archive

Re: Exporting XML as DocBook, etc

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61499] Re: Exporting XML as DocBook, etc
  • From: "Hans Michel" <hmichel at cox.net>
  • Date: Thu, 20 Oct 2005 00:56:19 -0400 (EDT)
  • References: <dj4qip$k1a$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Steven:

A tall order that Mathematica can possibly accomplish.
As much as we complain about the help files there is enough starter material 
in the XML section to get you going but it would be a lot of work.
See examples in "Converting a Notebook to HTML"

You want to deal with SymbolicXML
(Untested steps) So I think the steps would be
Open a notebook
1.
    nb = NotebookOpen[ToFileName[Directory[], "yournotebookhere.nb"]];
2.
    data = NotebookGet[nb];
Export the Mathematica Notebook as SymbolicXML
    See function ToSymbolicXML
    See function ToCompactXML to remove namespace stuff
These are not perfect functions so you may need to debug
    See function SymbolicXMLErrors
3.
    xmldata = XML`ToCompactXML[XML`ToSymbolicXML[data], 
"http://www.wolfram.com/XML";];

Use ConversionOptions to take file from SymbolicXML to DocBook SGML or XML
4.
    Export["yourfilenamehere.sgm", xmldata, "XML", ConversionOptions -> 
{"ElementFormatting" -> yourfunctionhere}]

yourfunctionhere would be a function that takes SymbolicXML Element to 
DocBook Element. yourfunction here would also have to deal with moving 
elments off the tree (transforms).

But I would urge you to check the help files.

Hans

"Steven T. Hatton" <hattons at globalsymmetry.com> wrote in message 
news:dj4qip$k1a$1 at smc.vnet.net...
> Is there a way to export XML from Mathematica specifying that the primary
> document type is DocBook (or some other DTD)?  I see that I can import 
> XML,
> and validate against a DTD.  I do not see a way to export any other
> document type than MathML, and Mathematica specific NotebookML, etc.
>
> This really is frustrating.  I should be able to specify a DTD, or at 
> least
> extend the NotebookML so that I can have well structured mathematical
> statements as are found in properly written textbooks.  There should be a
> <theorem> element, a <defintion> element, a <proof> element, a <paragraph>
> element, a <section> (that nests arbitrarily deeply), etc., etc.  There
> should be a means of tagging inline definitions with more than a font 
> type.
> There should be an easy way for creating numbered lists of steps in a
> derivation.  And all of this should be apparent to the user in an
> unobtrusive and intuitive way.
>
> The capability is in the core design of Mathematica.  That fact that it's
> not there amazes me.
> -- 
> "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: Re: Language vs. Library why it matters
  • Next by Date: Re: Language vs. Library why it matters / Turing
  • Previous by thread: Re: Exporting XML as DocBook, etc
  • Next by thread: Re: Exporting XML as DocBook, etc