Changeset 133
- Timestamp:
- 04/30/02 00:47:35 (6 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBFoundation/RBFoundation/XMLBuilder.py
r129 r133 76 76 _encoding = 'ASCII' 77 77 _seperator = '.' 78 _ParserFactory = _ParserCreate 78 79 79 80 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 130 131 self._elements[-1]._addData(data) 131 132 133 def SetParserFactory(self, ParserFactory): 134 self._ParserFactory = ParserFactory 135 132 136 def _CreateParser(self): 133 137 """Creates the Expat parser in a python-OO way.""" 134 parser = _ParserCreate(self._encoding, self._seperator)138 parser = self._ParserFactory(self._encoding, self._seperator) 135 139 parser.returns_unicode = self._encoding != 'ASCII' and 1 or 0 136 140 parser.StartElementHandler = _BindCallable(self._start_element) trunk/RBFoundation/RBFoundation/XMLObjectify.py
r129 r133 254 254 return '<%s %r %r>' % (result[1:-1], self.__namespace__, self.__node__) 255 255 256 def __cmp__(self, other): 257 """Compare two objects. If other object is objectified, compare simplest elements first""" 258 if isinstance(other, ObjectifiedXML): 259 result = cmp(self.__namespace__, other.__namespace__) 260 if result: return result 261 result = cmp(self.__node__, other.__node__) 262 if result: return result 263 result = cmp(self._attributes, other._attributes) 264 if result: return result 265 result = cmp(self._elements, other._elements) 266 return result 267 else: 268 return cmp(other.__class__(self('')), other) 269 256 270 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 271 #~ Protected Methods
