home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / xml / dom / __init__.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  6.3 KB  |  145 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''W3C Document Object Model implementation for Python.
  5.  
  6. The Python mapping of the Document Object Model is documented in the
  7. Python Library Reference in the section on the xml.dom package.
  8.  
  9. This package contains the following modules:
  10.  
  11. minidom -- A simple implementation of the Level 1 DOM with namespace
  12.            support added (based on the Level 2 specification) and other
  13.            minor Level 2 functionality.
  14.  
  15. pulldom -- DOM builder supporting on-demand tree-building for selected
  16.            subtrees of the document.
  17.  
  18. '''
  19.  
  20. class Node:
  21.     '''Class giving the NodeType constants.'''
  22.     ELEMENT_NODE = 1
  23.     ATTRIBUTE_NODE = 2
  24.     TEXT_NODE = 3
  25.     CDATA_SECTION_NODE = 4
  26.     ENTITY_REFERENCE_NODE = 5
  27.     ENTITY_NODE = 6
  28.     PROCESSING_INSTRUCTION_NODE = 7
  29.     COMMENT_NODE = 8
  30.     DOCUMENT_NODE = 9
  31.     DOCUMENT_TYPE_NODE = 10
  32.     DOCUMENT_FRAGMENT_NODE = 11
  33.     NOTATION_NODE = 12
  34.  
  35. INDEX_SIZE_ERR = 1
  36. DOMSTRING_SIZE_ERR = 2
  37. HIERARCHY_REQUEST_ERR = 3
  38. WRONG_DOCUMENT_ERR = 4
  39. INVALID_CHARACTER_ERR = 5
  40. NO_DATA_ALLOWED_ERR = 6
  41. NO_MODIFICATION_ALLOWED_ERR = 7
  42. NOT_FOUND_ERR = 8
  43. NOT_SUPPORTED_ERR = 9
  44. INUSE_ATTRIBUTE_ERR = 10
  45. INVALID_STATE_ERR = 11
  46. SYNTAX_ERR = 12
  47. INVALID_MODIFICATION_ERR = 13
  48. NAMESPACE_ERR = 14
  49. INVALID_ACCESS_ERR = 15
  50. VALIDATION_ERR = 16
  51.  
  52. class DOMException(Exception):
  53.     '''Abstract base class for DOM exceptions.
  54.     Exceptions with specific codes are specializations of this class.'''
  55.     
  56.     def __init__(self, *args, **kw):
  57.         if self.__class__ is DOMException:
  58.             raise RuntimeError('DOMException should not be instantiated directly')
  59.         self.__class__ is DOMException
  60.         Exception.__init__(self, *args, **kw)
  61.  
  62.     
  63.     def _get_code(self):
  64.         return self.code
  65.  
  66.  
  67.  
  68. class IndexSizeErr(DOMException):
  69.     code = INDEX_SIZE_ERR
  70.  
  71.  
  72. class DomstringSizeErr(DOMException):
  73.     code = DOMSTRING_SIZE_ERR
  74.  
  75.  
  76. class HierarchyRequestErr(DOMException):
  77.     code = HIERARCHY_REQUEST_ERR
  78.  
  79.  
  80. class WrongDocumentErr(DOMException):
  81.     code = WRONG_DOCUMENT_ERR
  82.  
  83.  
  84. class InvalidCharacterErr(DOMException):
  85.     code = INVALID_CHARACTER_ERR
  86.  
  87.  
  88. class NoDataAllowedErr(DOMException):
  89.     code = NO_DATA_ALLOWED_ERR
  90.  
  91.  
  92. class NoModificationAllowedErr(DOMException):
  93.     code = NO_MODIFICATION_ALLOWED_ERR
  94.  
  95.  
  96. class NotFoundErr(DOMException):
  97.     code = NOT_FOUND_ERR
  98.  
  99.  
  100. class NotSupportedErr(DOMException):
  101.     code = NOT_SUPPORTED_ERR
  102.  
  103.  
  104. class InuseAttributeErr(DOMException):
  105.     code = INUSE_ATTRIBUTE_ERR
  106.  
  107.  
  108. class InvalidStateErr(DOMException):
  109.     code = INVALID_STATE_ERR
  110.  
  111.  
  112. class SyntaxErr(DOMException):
  113.     code = SYNTAX_ERR
  114.  
  115.  
  116. class InvalidModificationErr(DOMException):
  117.     code = INVALID_MODIFICATION_ERR
  118.  
  119.  
  120. class NamespaceErr(DOMException):
  121.     code = NAMESPACE_ERR
  122.  
  123.  
  124. class InvalidAccessErr(DOMException):
  125.     code = INVALID_ACCESS_ERR
  126.  
  127.  
  128. class ValidationErr(DOMException):
  129.     code = VALIDATION_ERR
  130.  
  131.  
  132. class UserDataHandler:
  133.     '''Class giving the operation constants for UserDataHandler.handle().'''
  134.     NODE_CLONED = 1
  135.     NODE_IMPORTED = 2
  136.     NODE_DELETED = 3
  137.     NODE_RENAMED = 4
  138.  
  139. XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
  140. XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
  141. XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'
  142. EMPTY_NAMESPACE = None
  143. EMPTY_PREFIX = None
  144. from domreg import getDOMImplementation, registerDOMImplementation
  145.