[Date Index]
[Thread Index]
[Author Index]
Re: Exporting XML as DocBook, etc
*To*: mathgroup at smc.vnet.net
*Subject*: [mg61702] Re: Exporting XML as DocBook, etc
*From*: "Steven T. Hatton" <hattons at globalsymmetry.com>
*Date*: Wed, 26 Oct 2005 01:02:03 -0400 (EDT)
*References*: <dj4qip$k1a$1@smc.vnet.net> <dj783p$gjl$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Hans Michel wrote:
> 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
I finally figured out how to, more or less, accomplish my first goal. The
problem wasn't that I hadn't read the documentation. The problem was that
I _had_ read the documentation. If I handjam the Doctype, and omit the
ConversionOptions the doctype is preserved. I still see no way to validate
a document other than reimporting it.
Here's a brief description of part of what XEmacs (or Emacs - It works out
of the box with XEmacs) and PSGML will do with XML. It will validate on
the fly. If there is an error in the document structure, it will be
indicated by anomalous indentation behavior, etc. Mathematica uses a
similar emacsism in other contexts. When I place the input cursor in
between the begin and end tags of a valid element, I can get a list of all
the valid child elements which could be added at that point. By selecting
a given element type, it is automatically inserted into the document along
with any required child elements. In many cases I can get a listing of
required or optional attributes for a given element, and depending on the
DTD, I may even get a list of possible values. These of course will be
automatically added when I select them from the list. The list can either
be viewed using a context menu (XEmacs) opened with a rmc, or through the
use of Emacs keyboard arcana.
Since the Mathematica FrontEnd functions in a way strikingly similar to
Emacs, (ask the person who created the FrontEnd what editor he used when
doing so) there seems to be very little reason the same behavior couldn't
be emulated in Mathematica.
This is an example of the kind of thing I would like to see supported by
Mathematica: http://www.mathweb.org/omdoc/index.html. It's actually
mind-numbingly complex, and the prospect of a non-expert using any
meaningful subset to it's full potential is unlikely. Nonetheless, it
could (I believe) be used quite effectively to facilitate and enforce the
kind of structure I want in a formal mathematical exposition without
delving too deeply into the area of automated proofs. It seems Mathematica
has the hardest problems solved as regards creating a powerful support tool
for the OMDoc - or other __ML specification. There is lots of support for
layout, and face format. It's like they were at the defender's
one-yard-line with the ball and no-one around, and they decided to call
timeout.
I do have to concede that many math textbooks are not as formally structured
as I had perceived them to be prior to undertaking this exercise. That is
not to suggest that I have changed my views regarding the importance of
such formallism.
--
"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: Complex numbers in Mathematica**
Next by Date:
**Re: Accessing Elements of Arrays in TableForm**
Previous by thread:
**Re: Exporting XML as DocBook, etc**
Next by thread:
**Memory use by NMaximize (and NMinimize)**
| |