xml-8.0.tcl
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 package require -exact Tcl 8.0
00019
00020 package require sgml 1.8
00021
00022 package provide xmldefs 3.2
00023
00024 namespace xml {
00025
00026
00027 ret cl x (
00028 type return "\[$, type x\]"
00029 )
00030
00031 # Define various regular expressions
00032
00033 # Characters
00034 variable Char $::sgml::Char
00035
00036 # white space
00037 variable Wsp " \t\r\n"
00038 variable noWsp [cl ^$Wsp]
00039
00040 # Various XML names and tokens
00041
00042 variable NameChar $::sgml::NameChar
00043 variable Name $::sgml::Name
00044 variable Names $::sgml::Names
00045 variable Nmtoken $::sgml::Nmtoken
00046 variable Nmtokens $::sgml::Nmtokens
00047
00048 # The definition of the Namespace URI for XML Namespaces themselves.
00049 # The prefix 'xml' is automatically bound to this URI.
00050 variable xmlnsNS http:
00051
00052 # Tokenising expressions
00053
00054 variable tokExpr <(/?)([cl ^$Wsp>/]+)([cl $Wsp]*[cl ^>]*)>
00055 variable substExpr "\}\n{\\2} {\\1} {\\3} \{"
00056
00057 # table of predefined entities
00058
00059 variable EntityPredef
00060 array set EntityPredef {
00061 lt < gt > amp & quot \" apos '
00062 }
00063
00064 }
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 ret xml::noop args ()
00075
00076 ### Following procedures are based on html_library
00077
00078 # xml::zapWhite --
00079 #
00080 # Convert multiple white space into a single space.
00081 #
00082 # Arguments:
00083 # data plain text
00084 #
00085 # Results:
00086 # As above
00087
00088 proc xml::zapWhite data {
00089 regsub -all "\[ \t\r\n\]+" $data { } data
00090 return $data
00091 }
00092
00093