KitXml (Tcl package) allows to parse and generate xml or html files in linux tcl/tk applications.
KitXml respects the tcl/tk natural syntax for scripts easy developpment.
KitXml is based on "libxml" written by Daniel Veillard, see http://xmlsoft.org.
Example tk script code file, using KitXml :
#!/usr/bin/wish -f#call package
package require KitXml#create new widget xml doc ".mydoc" (default file name "mydoc.xml")
xml .mydoc#create root node ".book"
.mydoc root node .book#add some properties
.mydoc.book add properties -author "Cyril BARBATO" -date "Febuary 25, 2002"#add some nodes
.mydoc.book add node .title -content "The KitXml Package"#add node
set node [.mydoc.book add node .chapter]#another way for set node "chapter" content
$node set content "1) Introduce"#add properties
$node add properties -numberpages 10 -format A4#add node
set node [.mydoc.book add node .chapter]#set node "chapter" content
$node set content "2) Introduce"#save xml doc
.mydoc save -file foo.xml#example for read data
label .author -text [.mydoc.book get property -author] ; pack .author
label .root -text [ .mydoc get root ] ; pack .root
label .rootnodeslist -text [ .mydoc.book get nodeslist ] ; pack .rootnodeslist
label .date -text [.mydoc.book get property -date] ; pack .date
label .title -text [.mydoc.book.title get content] ; pack .title
label .chapter -text [.mydoc.book.chapter get content] ; pack .chapter
label .chapter1 -text [.mydoc.book.chapter(1) get content] ; pack .chapter1
#destroy node exemple
.mydoc.book.chapter(1) delete thisnode
see also : alldemos.tcl include in package.
KitXml documentation :
All doc. in The KitXml Programmer's ManualLoad KitXml package :
xml command description only, on xmlcmd.html
html command description only, on htmlcmd.html
kitxml-X.X.X.tar.gz(This package include libxml2.so)
Install KitXml package :
# tar -xvzf kitxml-X.X.X.tar.gzBugs, please report bugs on :
if you want to compil
# cd kitxml/usr/src/kitxml/generic
# sudo make ; sudo make install
if you want to use precompil linux version (debian,mandriva...)
# cd kitxml
# sudo ./install