List of all members.
Detailed Description
Definition at line 9 of file XML2Python.py.
Constructor & Destructor Documentation
def python::XML2Python::DataNode::__init__ |
( |
|
self, |
|
|
|
kwargs |
|
) |
| |
Definition at line 11 of file XML2Python.py.
00012 :
00013 self._attrs = {}
00014 self._data = None
00015 self._ncDict = kwargs.get ('nameChangeDict', {})
Member Function Documentation
def python::XML2Python::DataNode::__contains__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
Definition at line 26 of file XML2Python.py.
00027 :
00028 return self._attrs.has_key(name)
def python::XML2Python::DataNode::__getattr__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
Definition at line 32 of file XML2Python.py.
00033 :
00034 if name.startswith('__'):
00035
00036 raise AttributeError (name)
00037 return self._attrs.get (name, None)
def python::XML2Python::DataNode::__getitem__ |
( |
|
self, |
|
|
|
key |
|
) |
| |
Definition at line 20 of file XML2Python.py.
00021 :
00022 if isinstance (key, basestring):
00023 return self._attrs.get(key,None)
00024 else:
00025 return [self][key]
def python::XML2Python::DataNode::__len__ |
( |
|
self | ) |
|
def python::XML2Python::DataNode::__nonzero__ |
( |
|
self | ) |
|
Definition at line 29 of file XML2Python.py.
00030 :
00031 return bool (self._attrs or self._data)
def python::XML2Python::DataNode::__repr__ |
( |
|
self | ) |
|
Definition at line 55 of file XML2Python.py.
00056 :
00057 items = sorted (self._attrs.items())
00058 if self._data:
00059 items.append(('data', self._data))
00060 return u'{%s}' % ', '.join([u'%s:%s' % (k,repr(v)) for k,v in items])
def python::XML2Python::DataNode::__str__ |
( |
|
self | ) |
|
Definition at line 52 of file XML2Python.py.
00053 :
00054 return self._data or ''
def python::XML2Python::DataNode::_add_xml_attr |
( |
|
self, |
|
|
|
name, |
|
|
|
value |
|
) |
| [private] |
Definition at line 38 of file XML2Python.py.
00039 :
00040 change = self._ncDict.get (name)
00041 if change:
00042 name = change
00043 if name in self._attrs:
00044
00045 children = self._attrs[name]
00046 if not isinstance(children, list):
00047 children = [children]
00048 self._attrs[name] = children
00049 children.append(value)
00050 else:
00051 self._attrs[name] = value
def python::XML2Python::DataNode::attributes |
( |
|
self | ) |
|
Definition at line 61 of file XML2Python.py.
00062 :
00063 return self._attrs
00064
Member Data Documentation