20-Jul-03 Brian Theado I modified the below to use the pure Tcl XML package found at [1], added a menu pick for importing and checked it into CVS. This functionality will be part of the next release. Download a preview at http://tkoutline.sourceforge.net/tkoutline-devel.kit.
A quick hack for being able to import opml files into tkoutline (inspired by a request from Laurent Duperval):
proc opml2IndentedText {xmlFile} {
package require tdom
set xmlfd [open $xmlFile]
set xml [read $xmlfd]
close $xmlfd
set root [[dom parse $xml] documentElement]
set output ""
foreach node [$root selectNodes //outline] {
set indent [string repeat " " [$node selectNodes count(ancestor::outline)]]
lappend output "$indent[$node @text]"
}
return [join $output \n]
}
proc opml2TkoutlineFile {opmlFile outputFile} {
set tree [::outlinewidget::textToTree [opml2IndentedText $opmlFile]]
$tree walk root -command {%t set %n -key expand 1}
::saveTreeToFile $tree $outputFile
}From within tkoutline, open the console by hitting <F2>. Paste in the above code. If you have the tdom library installed [2], then just execute opml2TkoutlineFile passing the input opml filename and the output filename as parameters.
If you don't have tdom installed, then the easiest way is to download http://mini.net/sdarchive/tdom.kit and before you execute opml2TkoutlineFile, execute the following command:
source c:/path/to/tdom.kit
That should make the tdom library available to you (tdom is binary and the above kit works only for Linux, Mac OS X, Windows, and FreeBSD).
| Updated 20 Jul 2003, 12:14 GMT Search - Recent Changes - Reference - About WiKit - Go to Tkoutline - Help |