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

Re: Exporting XML as DocBook, etc

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61507] Re: Exporting XML as DocBook, etc
  • From: "Steven T. Hatton" <hattons at globalsymmetry.com>
  • Date: Thu, 20 Oct 2005 05:01:14 -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 can create the XML structure for DocBook without a problem in Mathematica,
but I don't have any means of leveraging the DTD to determine what elements
are valid in a given context.  What I would like to have, at a minimum, is
the ability to specify the doctype of the exported document.  I have an
option that determines whether or not the doctype is included, but I don't
have one for specifying which doctype is used.  I am pretty sure I can hack
together something with raw strings, but that kind of defeats the purpose.

I also whish there were a better formatting mechanism for the Mathematica
representation of XML.  It is very hard to read when the elements are on
the same line, regardless of whether it indents when it wraps.  For a
document of any significant complexity, it is virtually impossible to edit
it in the form presented. 

-- 
"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: Memory use by NMaximize (and NMinimize)
  • Next by Date: refer to the result of FindRoot[ ]
  • Previous by thread: Re: Exporting XML as DocBook, etc
  • Next by thread: Re: Exporting XML as DocBook, etc