ATLAS Offline Software
Loading...
Searching...
No Matches
python.xmldict.XmlDictObject Class Reference

module implementation ---------------------------------------------------— More...

Inheritance diagram for python.xmldict.XmlDictObject:
Collaboration diagram for python.xmldict.XmlDictObject:

Public Member Functions

 __init__ (self, initdict=None)
 __getattr__ (self, item)
 __setattr__ (self, item, value)
 __str__ (self)
 def getitem(self, item): o = dict.__getitem__(self, item) if isinstance(o, str): return _xml_unescape(o) return o
 unwrap (self)

Static Public Member Functions

 wrap (x)

Static Protected Member Functions

 _unwrap (x)

Detailed Description

module implementation ---------------------------------------------------—

Definition at line 26 of file xmldict.py.

Constructor & Destructor Documentation

◆ __init__()

python.xmldict.XmlDictObject.__init__ ( self,
initdict = None )

Definition at line 27 of file xmldict.py.

27 def __init__(self, initdict=None):
28 if initdict is None:
29 initdict = {}
30 dict.__init__(self, initdict)
31

Member Function Documentation

◆ __getattr__()

python.xmldict.XmlDictObject.__getattr__ ( self,
item )

Definition at line 32 of file xmldict.py.

32 def __getattr__(self, item):
33 return self.__getitem__(item)
34

◆ __setattr__()

python.xmldict.XmlDictObject.__setattr__ ( self,
item,
value )

Definition at line 35 of file xmldict.py.

35 def __setattr__(self, item, value):
36 self.__setitem__(item, value)
37

◆ __str__()

python.xmldict.XmlDictObject.__str__ ( self)

def getitem(self, item): o = dict.__getitem__(self, item) if isinstance(o, str): return _xml_unescape(o) return o

def setitem(self, item, value): if isinstance(value, str): value = _xml_unescape(value) dict.__setitem__(self, item, value)

Definition at line 49 of file xmldict.py.

49 def __str__(self):
50 if '_text' in self:
51 return self['_text']
52 else:
53 return dict.__str__(self)
54

◆ _unwrap()

python.xmldict.XmlDictObject._unwrap ( x)
staticprotected

Definition at line 66 of file xmldict.py.

66 def _unwrap(x):
67 if isinstance(x, dict):
68 return dict ((k, XmlDictObject._unwrap(v))
69 for (k, v) in x.iteritems())
70 elif isinstance(x, list):
71 return [XmlDictObject._unwrap(v) for v in x]
72 else:
73 return x
74

◆ unwrap()

python.xmldict.XmlDictObject.unwrap ( self)

Definition at line 75 of file xmldict.py.

75 def unwrap(self):
76 return XmlDictObject._unwrap(self)
77

◆ wrap()

python.xmldict.XmlDictObject.wrap ( x)
static

Definition at line 56 of file xmldict.py.

56 def wrap(x):
57 if isinstance(x, dict):
58 return XmlDictObject ((k, XmlDictObject.wrap(v))
59 for (k, v) in x.iteritems())
60 elif isinstance(x, list):
61 return [XmlDictObject.wrap(v) for v in x]
62 else:
63 return x
64

The documentation for this class was generated from the following file: