---- [http://tkfp.sourceforge.net/XML_DOM_Tk_Text_Browser_Editor.gif] ---- # XML-tDOM-Browser-Editor # May 18, 2004 # Alex Caldwell M.D. # alcald2000@yahoo.com # derived from xmlbrowser.tcl # by Richard Suchenwirth http://mini.net/tcl/3884 # Purpose: # to get some XML data, parse it into an XML DOM tree in memory, and then # map the DOM structure into an editable display in a Tk text widget. A sort of "Map" is # generated in the text widget using marks and tags that corresponds to elements and # attributes in the DOM structure. Event bindings are used so that any changes to the data # in the text widget are updated in the DOM memory structure in parallel. The modified DOM # can then be dumped as XML to a file, sent to another part of the application, transmitted # over the network, etc. It currently dumps the modified DOM as XML the console when any # change is made to the data. # This is similar to domtext widget in Swish and Waxml by Steve Ball http://waxml.sourceforge.net # I was using a similar technique with SAX and mapping the XML elements and attributes with # Tk text widget marks and tags. The problem with the SAX method is that it's sort of one-way # SAX works good for mapping the XML data to the text widget display, but when you want to # reverse that, and go back to XML from the Tk text widget display, you have to write a unique # Tcl script to collect your data and convert it back to XML. So the SAX method is not # generalizable. Each change in the XML schema means you have to re-write your script. # With the DOM model it is automatic in both directions and more generalizable to any XML data. # To do: