Module xmllib
[hide private]
[frames] | no frames]

Module xmllib

A parser for XML, using the derived class as static DTD.

Classes [hide private]
Error
XMLParser
TestXMLParser
Functions [hide private]
 
test(args=None)
Variables [hide private]
  version = '0.3'
  _S = '[ \t\r\n]+'
  _opS = '[ \t\r\n]*'
  _Name = '[a-zA-Z_:][-a-zA-Z0-9._:]*'
  _QStr = '(?:\'[^\']*\'|"[^"]*")'
  illegal = re.compile(r'[^\t\r\n -~\xa0-\xff]')
  interesting = re.compile(r'[\]&<]')
  amp = re.compile(r'&')
  ref = re.compile(r'&([a-zA-Z_:][-a-zA-Z0-9\._:]*|#[0-9]+|#x[0-...
  entityref = re.compile(r'&(?P<name>[a-zA-Z_:][-a-zA-Z0-9\._:]*...
  charref = re.compile(r'&#(?P<char>[0-9]+[^0-9]|x[0-9a-fA-F]+[^...
  space = re.compile(r'[ \t\r\n]+$')
  newline = re.compile(r'\n')
  attrfind = re.compile(r'[ \t\r\n]+(?P<name>[a-zA-Z_:][-a-zA-Z0...
  starttagopen = re.compile(r'<[a-zA-Z_:][-a-zA-Z0-9\._:]*')
  starttagend = re.compile(r'[ \t\r\n]*(?P<slash>/?)>')
  starttagmatch = re.compile(r'<(?P<tagname>[a-zA-Z_:][-a-zA-Z0-...
  endtagopen = re.compile(r'</')
  endbracket = re.compile(r'[ \t\r\n]*>')
  endbracketfind = re.compile(r'(?:[^>\'"]|(?:\'[^\']*\'|"[^"]*"...
  tagfind = re.compile(r'[a-zA-Z_:][-a-zA-Z0-9\._:]*')
  cdataopen = re.compile(r'<!\[CDATA\[')
  cdataclose = re.compile(r'\]\]>')
  _SystemLiteral = '(?P<%s>(?:\'[^\']*\'|"[^"]*"))'
  _PublicLiteral = '(?P<%s>"[-\'\\(\\)+,./:=?;!*#@$_%% \n\ra-zA-...
  _ExternalId = '(?:SYSTEM|PUBLIC[ \t\r\n]+(?P<pubid>"[-\'\\(\\)...
  doctype = re.compile(r'<!DOCTYPE[ \t\r\n]+(?P<name>[a-zA-Z_:][...
  xmldecl = re.compile(r'<\?xml[ \t\r\n]+version[ \t\r\n]*=[ \t\...
  procopen = re.compile(r'<\?(?P<proc>[a-zA-Z_:][-a-zA-Z0-9\._:]...
  procclose = re.compile(r'[ \t\r\n]*\?>')
  commentopen = re.compile(r'<!--')
  commentclose = re.compile(r'-->')
  doubledash = re.compile(r'--')
  attrtrans = '\x00\x01\x02\x03\x04\x05\x06\x07\x08 \x0b\x0c \x...
  _NCName = '[a-zA-Z_][-a-zA-Z0-9._]*'
  ncname = re.compile(r'[a-zA-Z_][-a-zA-Z0-9\._]*$')
  qname = re.compile(r'(?:(?P<prefix>[a-zA-Z_][-a-zA-Z0-9\._]*):...
  xmlns = re.compile(r'xmlns(?::(?P<ncname>[a-zA-Z_][-a-zA-Z0-9\...
  __warningregistry__ = {('The xmllib module is obsolete. Use x...

Imports: re, string


Variables Details [hide private]

ref

Value:
re.compile(r'&([a-zA-Z_:][-a-zA-Z0-9\._:]*|#[0-9]+|#x[0-9a-fA-F]+)[^-a\
-zA-Z0-9\._:]')

entityref

Value:
re.compile(r'&(?P<name>[a-zA-Z_:][-a-zA-Z0-9\._:]*)[^-a-zA-Z0-9\._:]')

charref

Value:
re.compile(r'&#(?P<char>[0-9]+[^0-9]|x[0-9a-fA-F]+[^0-9a-fA-F])')

attrfind

Value:
re.compile(r'[ \t\r\n]+(?P<name>[a-zA-Z_:][-a-zA-Z0-9\._:]*)([ \t\r\n]\
*=[ \t\r\n]*(?P<value>(?:\'[^\']*\'|"[^"]*")|[-a-zA-Z0-9\.:\+\*%\?!\(\\
)_#=~]+))?')

starttagmatch

Value:
re.compile(r'<(?P<tagname>[a-zA-Z_:][-a-zA-Z0-9\._:]*)(?P<attrs>(?:[ \\
t\r\n]+(?P<name>[a-zA-Z_:][-a-zA-Z0-9\._:]*)([ \t\r\n]*=[ \t\r\n]*(?P<\
value>(?:\'[^\']*\'|"[^"]*")|[-a-zA-Z0-9\.:\+\*%\?!\(\)_#=~]+))?)*)[ \\
t\r\n]*(?P<slash>/?)>')

endbracketfind

Value:
re.compile(r'(?:[^>\'"]|(?:\'[^\']*\'|"[^"]*"))*>')

_PublicLiteral

Value:
'''(?P<%s>"[-\'\\(\\)+,./:=?;!*#@$_%% 
\ra-zA-Z0-9]*"|\'[-\\(\\)+,./:=?;!*#@$_%% 
\ra-zA-Z0-9]*\')'''

_ExternalId

Value:
'''(?:SYSTEM|PUBLIC[ \t\r
]+(?P<pubid>"[-\'\\(\\)+,./:=?;!*#@$_% 
\ra-zA-Z0-9]*"|\'[-\\(\\)+,./:=?;!*#@$_% 
\ra-zA-Z0-9]*\'))[ \t\r
]+(?P<syslit>(?:\'[^\']*\'|"[^"]*"))'''

doctype

Value:
re.compile(r'<!DOCTYPE[ \t\r\n]+(?P<name>[a-zA-Z_:][-a-zA-Z0-9\._:]*)(\
?:[ \t\r\n]+(?:SYSTEM|PUBLIC[ \t\r\n]+(?P<pubid>"[-\'\(\)\+,\./:=\?;!\\
*#@\$_% \n\ra-zA-Z0-9]*"|\'[-\(\)\+,\./:=\?;!\*#@\$_% \n\ra-zA-Z0-9]*\\
'))[ \t\r\n]+(?P<syslit>(?:\'[^\']*\'|"[^"]*")))?[ \t\r\n]*')

xmldecl

Value:
re.compile(r'<\?xml[ \t\r\n]+version[ \t\r\n]*=[ \t\r\n]*(?P<version>(\
?:\'[^\']*\'|"[^"]*"))(?:[ \t\r\n]+encoding[ \t\r\n]*=[ \t\r\n]*(?P<en\
coding>\'[A-Za-z][-A-Za-z0-9\._]*\'|"[A-Za-z][-A-Za-z0-9\._]*"))?(?:[ \
\t\r\n]+standalone[ \t\r\n]*=[ \t\r\n]*(?P<standalone>\'(?:yes|no)\'|"\
(?:yes|no)"))?[ \t\r\n]*\?>')

procopen

Value:
re.compile(r'<\?(?P<proc>[a-zA-Z_:][-a-zA-Z0-9\._:]*)[ \t\r\n]*')

attrtrans

Value:
'\x00\x01\x02\x03\x04\x05\x06\x07\x08  \x0b\x0c \x0e\x0f\x10\x11\x12\x\
13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./012\
3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvw\
xyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8\
e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\\
xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb\
1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\\
xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd\
...

qname

Value:
re.compile(r'(?:(?P<prefix>[a-zA-Z_][-a-zA-Z0-9\._]*):)?(?P<local>[a-z\
A-Z_][-a-zA-Z0-9\._]*)$')

xmlns

Value:
re.compile(r'xmlns(?::(?P<ncname>[a-zA-Z_][-a-zA-Z0-9\._]*))?$')

__warningregistry__

Value:
{('The xmllib module is obsolete.  Use xml.sax instead.',
  <type 'exceptions.DeprecationWarning'>,
  9): 1}