home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / lib / tclxml2.0 / xml-8.0.tcl < prev    next >
Encoding:
Text File  |  2001-10-22  |  2.6 KB  |  105 lines

  1. # xml-8.0.tcl --
  2. #
  3. #    This file provides generic XML services for all implementations.
  4. #    This file supports Tcl 8.0 regular expressions.
  5. #
  6. #    See xmlparse.tcl for the Tcl implementation of a XML parser.
  7. #
  8. # Copyright (c) 1998,1999 Zveno Pty Ltd
  9. # http://www.zveno.com/
  10. # Zveno makes this software and all associated data and documentation
  11. # ('Software') available free of charge for any purpose.
  12. # Copies may be made of this Software but all of this notice must be included
  13. # on any copy.
  14. # The Software was developed for research purposes and Zveno does not warrant
  15. # that it is error free or fit for any purpose.  Zveno disclaims any
  16. # liability for all claims, expenses, losses, damages and costs any user may
  17. # incur as a result of using, copying or modifying the Software.
  18. #
  19. # Copyright (c) 1997 Australian National University (ANU).
  20. # ANU makes this software and all associated data and documentation
  21. # ('Software') available free of charge for any purpose. You may make copies
  22. # of the Software but you must include all of this notice on any copy.
  23. # The Software was developed for research purposes and ANU does not warrant
  24. # that it is error free or fit for any purpose.  ANU disclaims any
  25. # liability for all claims, expenses, losses, damages and costs any user may
  26. # incur as a result of using, copying or modifying the Software.
  27. #
  28. # $Id: xml-8.0.tcl,v 1.3 2000/07/12 12:43:59 steve Exp $
  29.  
  30. package require -exact Tcl 8.0
  31.  
  32. package require sgml 1.8
  33.  
  34. package provide xmldefs 1.10
  35.  
  36. namespace eval xml {
  37.  
  38.     # Convenience routine
  39.     proc cl x {
  40.     return "\[$x\]"
  41.     }
  42.  
  43.     # Define various regular expressions
  44.  
  45.     # Characters
  46.     variable Char $::sgml::Char
  47.  
  48.     # white space
  49.     variable Wsp " \t\r\n"
  50.     variable noWsp [cl ^$Wsp]
  51.  
  52.     # Various XML names and tokens
  53.  
  54.     variable NameChar $::sgml::NameChar
  55.     variable Name $::sgml::Name
  56.     variable Names $::sgml::Names
  57.     variable Nmtoken $::sgml::Nmtoken
  58.     variable Nmtokens $::sgml::Nmtokens
  59.  
  60.     # Tokenising expressions
  61.  
  62.     variable tokExpr <(/?)([cl ^$Wsp>/]+)([cl $Wsp]*[cl ^>]*)>
  63.     variable substExpr "\}\n{\\2} {\\1} {\\3} \{"
  64.  
  65.     # table of predefined entities
  66.  
  67.     variable EntityPredef
  68.     array set EntityPredef {
  69.     lt <   gt >   amp &   quot \"   apos '
  70.     }
  71.  
  72. }
  73.  
  74. ###
  75. ###    General utility procedures
  76. ###
  77.  
  78. # xml::noop --
  79. #
  80. # A do-nothing proc
  81.  
  82. proc xml::noop args {}
  83.  
  84. ### Following procedures are based on html_library
  85.  
  86. # xml::zapWhite --
  87. #
  88. #    Convert multiple white space into a single space.
  89. #
  90. # Arguments:
  91. #    data    plain text
  92. #
  93. # Results:
  94. #    As above
  95.  
  96. proc xml::zapWhite data {
  97.     regsub -all "\[ \t\r\n\]+" $data { } data
  98.     return $data
  99. }
  100.  
  101.