xml-8.0.tcl

Go to the documentation of this file.
00001 /*  xml-8.0.tcl --*/
00002 /* */
00003 /*  This file provides generic XML services for all implementations.*/
00004 /*  This file supports Tcl 8.0 regular expressions.*/
00005 /* */
00006 /*  See xmlparse.tcl for the Tcl implementation of a XML parser.*/
00007 /* */
00008 /*  Copyright (c) 2005 by Explain.*/
00009 /*  http://www.explain.com.au/*/
00010 /*  Copyright (c) 1998-2004 Zveno Pty Ltd*/
00011 /*  http://www.zveno.com/*/
00012 /*  */
00013 /*  See the file "LICENSE" in this distribution for information on usage and*/
00014 /*  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.*/
00015 /* */
00016 /*  $Id: xml-8.0.tcl,v 1.7.2.1 2005/12/28 06:49:51 balls Exp $*/
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     /*  Convenience routine*/
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://www.w3.org/XML/1998/namespace
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 /*  General utility procedures*/
00068 /* */
00069 
00070 /*  xml::noop --*/
00071 /* */
00072 /*  A do-nothing proc*/
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 

Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1