tclxml/simple.tcl
Go to the documentation of this file.00001
00002
00003 exec tclsh "$0" "$@"
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 package require xml 3.2
00016
00017
00018 parser = [xml::parser]
00019 $parser configure -elementstartcommand EStart \
00020 -characterdatacommand PCData
00021
00022 ret EStart (type tag , type attlist , type args) {
00023 array set attr $attlist
00024 puts "Element \"$tag\" started with [array size attr] attributes"
00025 }
00026
00027 ret PCData text (
00028 type incr ::, type count [, type string , type length $, type text]
00029 )
00030
00031 set count 0
00032 $parser parse [read stdin]
00033
00034 puts "The document contains $count characters"
00035 exit 0
00036
00037