Changeset 133

Show
Ignore:
Timestamp:
04/30/02 00:47:35 (6 years ago)
Author:
sholloway
Message:

*** empty log message ***

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBFoundation/RBFoundation/XMLBuilder.py

    r129 r133  
    7676    _encoding = 'ASCII' 
    7777    _seperator = '.' 
     78    _ParserFactory = _ParserCreate 
    7879 
    7980    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    130131        self._elements[-1]._addData(data) 
    131132 
     133    def SetParserFactory(self, ParserFactory): 
     134        self._ParserFactory = ParserFactory 
     135 
    132136    def _CreateParser(self): 
    133137        """Creates the Expat parser in a python-OO way.""" 
    134         parser = _ParserCreate(self._encoding, self._seperator) 
     138        parser = self._ParserFactory(self._encoding, self._seperator) 
    135139        parser.returns_unicode = self._encoding != 'ASCII' and 1 or 0 
    136140        parser.StartElementHandler = _BindCallable(self._start_element) 
  • trunk/RBFoundation/RBFoundation/XMLObjectify.py

    r129 r133  
    254254        return '<%s %r %r>' % (result[1:-1], self.__namespace__, self.__node__) 
    255255         
     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 
    256270    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    257271    #~ Protected Methods