Why aren't nested groups? XML again.
- To: mathgroup at smc.vnet.net
- Subject: [mg61725] Why aren't nested groups? XML again.
- From: "Steven T. Hatton" <hattons at globalsymmetry.com>
- Date: Thu, 27 Oct 2005 05:01:58 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
It's not 100% correct to assert that cell grouping is not structurally hierarchical in terms of Mathematica cells, but the way it is done leaves me wondering why cells are not nested to reflect document structure. That is, why does a section not contain a subsection? I know there are many cases in which cells _are_ nested in Mathematica, so I doubt there is any fundamental obstacle to doing so. There may be sound reasons why things are done as they are. That is not currently making my life any easier when it comes to finding a means of working with XML _documents_ in Mathematica. If you search for "Visualizing the XML Tree" in the help browser, you should find an example of processing XML to produce a notebook reflecting the structure of the input XML. I emphasize that it is _reflecting_ the structure, not preserving it. One strategy I'm considering is to traverse an XML fragment, and create a collection of nested cells that somehow preserve the XML attributes of the original elements. I hope to be able to edit the document by adding additional nested cells, and then export it using a recursive function similar to the one use in the example mentioned above. One reason I have not tried this yet is that I really don't understand the consequence of nesting cells. With cell groupings (I have learned that there are limited ways to establish my own) the Mathematica notebook actually is organize hierarchically, but getting at that hierarchy, and exploiting it is non-trivial. It seems potentially much cleaner and intuitive to simply reproduce the XML structure as cells. Has anybody tried this sort of thing? Can it be made to work without extraordinary effort? -- "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