CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
python.XML2Python.DataNode Class Reference
Inheritance diagram for python.XML2Python.DataNode:

Public Member Functions

def __contains__ (self, name)
 
def __getattr__ (self, name)
 
def __getitem__ (self, key)
 
def __init__ (self, kwargs)
 
def __len__ (self)
 
def __nonzero__ (self)
 
def __repr__ (self)
 
def __str__ (self)
 
def attributes (self)
 

Private Member Functions

def _add_xml_attr (self, name, value)
 

Private Attributes

 _attrs
 
 _data
 
 _ncDict
 

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.

11  def __init__ (self, **kwargs):
12  self._attrs = {} # XML attributes and child elements
13  self._data = None # child text data
14  self._ncDict = kwargs.get ('nameChangeDict', {})
15 
def __init__(self, kwargs)
Definition: XML2Python.py:11

Member Function Documentation

def python.XML2Python.DataNode.__contains__ (   self,
  name 
)

Definition at line 26 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, and XML2Python.DataNode._attrs.

26  def __contains__ (self, name):
27  return name in self._attrs
28 
def __contains__(self, name)
Definition: XML2Python.py:26
def python.XML2Python.DataNode.__getattr__ (   self,
  name 
)

Definition at line 32 of file XML2Python.py.

32  def __getattr__ (self, name):
33  if name.startswith('__'):
34  # need to do this for Python special methods???
35  raise AttributeError (name)
36  return self._attrs.get (name, None)
37 
def __getattr__(self, name)
Definition: XML2Python.py:32
def python.XML2Python.DataNode.__getitem__ (   self,
  key 
)

Definition at line 20 of file XML2Python.py.

20  def __getitem__ (self, key):
21  if isinstance (key, basestring):
22  return self._attrs.get(key,None)
23  else:
24  return [self][key]
25 
def __getitem__(self, key)
Definition: XML2Python.py:20
def python.XML2Python.DataNode.__len__ (   self)

Definition at line 16 of file XML2Python.py.

16  def __len__ (self):
17  # treat single element as a list of 1
18  return 1
19 
def python.XML2Python.DataNode.__nonzero__ (   self)
def python.XML2Python.DataNode.__repr__ (   self)

Definition at line 55 of file XML2Python.py.

References SeedingNode< DATA >._data, python.XML2Python.DataNode._data, data_sources.node._data, XML2Python.DataNode._data, data_sources.json_file._data, data_sources.sqlite_schema._data, data_sources.json_data_node._data, DTBtiTrig._data, data_sources.json_list._data, DTTracoTrig._data, data_sources.json_dict._data, data_sources.json_basic._data, DTTFBitArray< N >._data, BitArray< N >._data, and join().

55  def __repr__ (self):
56  items = sorted (self._attrs.items())
57  if self._data:
58  items.append(('data', self._data))
59  return u'{%s}' % ', '.join([u'%s:%s' % (k,repr(v)) for k,v in items])
60 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def python.XML2Python.DataNode.__str__ (   self)
def python.XML2Python.DataNode._add_xml_attr (   self,
  name,
  value 
)
private

Definition at line 38 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, and XML2Python.DataNode._attrs.

38  def _add_xml_attr (self, name, value):
39  change = self._ncDict.get (name)
40  if change:
41  name = change
42  if name in self._attrs:
43  # multiple attribute of the same name are represented by a list
44  children = self._attrs[name]
45  if not isinstance(children, list):
46  children = [children]
47  self._attrs[name] = children
48  children.append(value)
49  else:
50  self._attrs[name] = value
51 
def _add_xml_attr(self, name, value)
Definition: XML2Python.py:38
def python.XML2Python.DataNode.attributes (   self)

Definition at line 61 of file XML2Python.py.

References python.XML2Python.DataNode._attrs, and XML2Python.DataNode._attrs.

61  def attributes (self):
62  return self._attrs
63 
64 

Member Data Documentation

python.XML2Python.DataNode._attrs
private
python.XML2Python.DataNode._data
private
python.XML2Python.DataNode._ncDict
private

Definition at line 14 of file XML2Python.py.

Referenced by python.XML2Python.TreeBuilder.startElement().