nodes.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. #!/usr/bin/env/python
  2. # -*- coding: utf-8 -*-
  3. ###
  4. ### Author: Chris Iatrou (ichrispa@core-vector.net)
  5. ### Version: rev 13
  6. ###
  7. ### This program was created for educational purposes and has been
  8. ### contributed to the open62541 project by the author. All licensing
  9. ### terms for this source is inherited by the terms and conditions
  10. ### specified for by the open62541 project (see the projects readme
  11. ### file for more information on the LGPL terms and restrictions).
  12. ###
  13. ### This program is not meant to be used in a production environment. The
  14. ### author is not liable for any complications arising due to the use of
  15. ### this program.
  16. ###
  17. import sys
  18. import logging
  19. from datatypes import *
  20. logger = logging.getLogger(__name__)
  21. if sys.version_info[0] >= 3:
  22. # strings are already parsed to unicode
  23. def unicode(s):
  24. return s
  25. class Reference(object):
  26. # all either nodeids or strings with an alias
  27. def __init__(self, source, referenceType, target, isForward):
  28. self.source = source
  29. self.referenceType = referenceType
  30. self.target = target
  31. self.isForward = isForward
  32. def __str__(self):
  33. retval = str(self.source)
  34. if not self.isForward:
  35. retval = retval + "<"
  36. retval = retval + "--[" + str(self.referenceType) + "]--"
  37. if self.isForward:
  38. retval = retval + ">"
  39. return retval + str(self.target)
  40. def __repr__(self):
  41. return str(self)
  42. def __eq__(self, other):
  43. return str(self) == str(other)
  44. def __hash__(self):
  45. return hash(str(self))
  46. def RefOrAlias(s):
  47. try:
  48. return NodeId(s)
  49. except Exception:
  50. return s
  51. class Node(object):
  52. def __init__(self):
  53. self.id = NodeId()
  54. self.browseName = QualifiedName()
  55. self.displayName = LocalizedText()
  56. self.description = LocalizedText()
  57. self.symbolicName = String()
  58. self.writeMask = 0
  59. self.userWriteMask = 0
  60. self.references = set()
  61. self.hidden = False
  62. self.modelUri = None
  63. def __str__(self):
  64. return self.__class__.__name__ + "(" + str(self.id) + ")"
  65. def __repr__(self):
  66. return str(self)
  67. def sanitize(self):
  68. pass
  69. def parseXML(self, xmlelement):
  70. for idname in ['NodeId', 'NodeID', 'nodeid']:
  71. if xmlelement.hasAttribute(idname):
  72. self.id = RefOrAlias(xmlelement.getAttribute(idname))
  73. for (at, av) in xmlelement.attributes.items():
  74. if at == "BrowseName":
  75. self.browseName = QualifiedName(av)
  76. elif at == "DisplayName":
  77. self.displayName = LocalizedText(av)
  78. elif at == "Description":
  79. self.description = LocalizedText(av)
  80. elif at == "WriteMask":
  81. self.writeMask = int(av)
  82. elif at == "UserWriteMask":
  83. self.userWriteMask = int(av)
  84. elif at == "EventNotifier":
  85. self.eventNotifier = int(av)
  86. elif at == "SymbolicName":
  87. self.symbolicName = String(av)
  88. for x in xmlelement.childNodes:
  89. if x.nodeType != x.ELEMENT_NODE:
  90. continue
  91. if x.firstChild:
  92. if x.localName == "BrowseName":
  93. self.browseName = QualifiedName(x.firstChild.data)
  94. elif x.localName == "DisplayName":
  95. self.displayName = LocalizedText(x.firstChild.data)
  96. elif x.localName == "Description":
  97. self.description = LocalizedText(x.firstChild.data)
  98. elif x.localName == "WriteMask":
  99. self.writeMask = int(unicode(x.firstChild.data))
  100. elif x.localName == "UserWriteMask":
  101. self.userWriteMask = int(unicode(x.firstChild.data))
  102. if x.localName == "References":
  103. self.parseXMLReferences(x)
  104. def parseXMLReferences(self, xmlelement):
  105. for ref in xmlelement.childNodes:
  106. if ref.nodeType != ref.ELEMENT_NODE:
  107. continue
  108. source = RefOrAlias(str(self.id)) # deep-copy of the nodeid
  109. target = RefOrAlias(ref.firstChild.data)
  110. reftype = None
  111. forward = True
  112. for (at, av) in ref.attributes.items():
  113. if at == "ReferenceType":
  114. reftype = RefOrAlias(av)
  115. elif at == "IsForward":
  116. forward = not "false" in av.lower()
  117. self.references.add(Reference(source, reftype, target, forward))
  118. def popParentRef(self, parentreftypes):
  119. # HasSubtype has precedence
  120. for ref in self.references:
  121. if ref.referenceType == NodeId("ns=0;i=45") and not ref.isForward:
  122. self.references.remove(ref)
  123. return ref
  124. for ref in self.references:
  125. if ref.referenceType in parentreftypes and not ref.isForward:
  126. self.references.remove(ref)
  127. return ref
  128. return Reference(NodeId(), NodeId(), NodeId(), False)
  129. def popTypeDef(self):
  130. for ref in self.references:
  131. if ref.referenceType.i == 40 and ref.isForward:
  132. self.references.remove(ref)
  133. return ref
  134. return Reference(NodeId(), NodeId(), NodeId(), False)
  135. def replaceAliases(self, aliases):
  136. if str(self.id) in aliases:
  137. self.id = NodeId(aliases[self.id])
  138. if isinstance(self, VariableNode) or isinstance(self, VariableTypeNode):
  139. if str(self.dataType) in aliases:
  140. self.dataType = NodeId(aliases[self.dataType])
  141. new_refs = set()
  142. for ref in self.references:
  143. if str(ref.source) in aliases:
  144. ref.source = NodeId(aliases[ref.source])
  145. if str(ref.target) in aliases:
  146. ref.target = NodeId(aliases[ref.target])
  147. if str(ref.referenceType) in aliases:
  148. ref.referenceType = NodeId(aliases[ref.referenceType])
  149. new_refs.add(ref)
  150. self.references = new_refs
  151. def replaceNamespaces(self, nsMapping):
  152. self.id.ns = nsMapping[self.id.ns]
  153. self.browseName.ns = nsMapping[self.browseName.ns]
  154. if hasattr(self, 'dataType') and isinstance(self.dataType, NodeId):
  155. self.dataType.ns = nsMapping[self.dataType.ns]
  156. new_refs = set()
  157. for ref in self.references:
  158. ref.source.ns = nsMapping[ref.source.ns]
  159. ref.target.ns = nsMapping[ref.target.ns]
  160. ref.referenceType.ns = nsMapping[ref.referenceType.ns]
  161. new_refs.add(ref)
  162. self.references = new_refs
  163. class ReferenceTypeNode(Node):
  164. def __init__(self, xmlelement=None):
  165. Node.__init__(self)
  166. self.isAbstract = False
  167. self.symmetric = False
  168. self.inverseName = ""
  169. if xmlelement:
  170. self.parseXML(xmlelement)
  171. def parseXML(self, xmlelement):
  172. Node.parseXML(self, xmlelement)
  173. for (at, av) in xmlelement.attributes.items():
  174. if at == "Symmetric":
  175. self.symmetric = "false" not in av.lower()
  176. elif at == "InverseName":
  177. self.inverseName = str(av)
  178. elif at == "IsAbstract":
  179. self.isAbstract = "false" not in av.lower()
  180. for x in xmlelement.childNodes:
  181. if x.nodeType == x.ELEMENT_NODE:
  182. if x.localName == "InverseName" and x.firstChild:
  183. self.inverseName = str(unicode(x.firstChild.data))
  184. class ObjectNode(Node):
  185. def __init__(self, xmlelement=None):
  186. Node.__init__(self)
  187. self.eventNotifier = 0
  188. if xmlelement:
  189. self.parseXML(xmlelement)
  190. def parseXML(self, xmlelement):
  191. Node.parseXML(self, xmlelement)
  192. for (at, av) in xmlelement.attributes.items():
  193. if at == "EventNotifier":
  194. self.eventNotifier = int(av)
  195. class VariableNode(Node):
  196. def __init__(self, xmlelement=None):
  197. Node.__init__(self)
  198. self.dataType = NodeId()
  199. self.valueRank = -2
  200. self.arrayDimensions = []
  201. # Set access levels to read by default
  202. self.accessLevel = 1
  203. self.userAccessLevel = 1
  204. self.minimumSamplingInterval = 0.0
  205. self.historizing = False
  206. self.value = None
  207. self.xmlValueDef = None
  208. if xmlelement:
  209. self.parseXML(xmlelement)
  210. def parseXML(self, xmlelement):
  211. Node.parseXML(self, xmlelement)
  212. for (at, av) in xmlelement.attributes.items():
  213. if at == "ValueRank":
  214. self.valueRank = int(av)
  215. elif at == "AccessLevel":
  216. self.accessLevel = int(av)
  217. elif at == "UserAccessLevel":
  218. self.userAccessLevel = int(av)
  219. elif at == "MinimumSamplingInterval":
  220. self.minimumSamplingInterval = float(av)
  221. elif at == "DataType":
  222. self.dataType = RefOrAlias(av)
  223. elif at == "ArrayDimensions":
  224. self.arrayDimensions = av.split(",")
  225. for x in xmlelement.childNodes:
  226. if x.nodeType != x.ELEMENT_NODE:
  227. continue
  228. if x.localName == "Value":
  229. self.xmlValueDef = x
  230. elif x.localName == "DataType":
  231. self.dataType = RefOrAlias(av)
  232. elif x.localName == "ValueRank":
  233. self.valueRank = int(unicode(x.firstChild.data))
  234. elif x.localName == "ArrayDimensions" and len(self.arrayDimensions) == 0:
  235. elements = x.getElementsByTagName("ListOfUInt32");
  236. if len(elements):
  237. for idx, v in enumerate(elements[0].getElementsByTagName("UInt32")):
  238. self.arrayDimensions.append(v.firstChild.data)
  239. elif x.localName == "AccessLevel":
  240. self.accessLevel = int(unicode(x.firstChild.data))
  241. elif x.localName == "UserAccessLevel":
  242. self.userAccessLevel = int(unicode(x.firstChild.data))
  243. elif x.localName == "MinimumSamplingInterval":
  244. self.minimumSamplingInterval = float(unicode(x.firstChild.data))
  245. elif x.localName == "Historizing":
  246. self.historizing = "false" not in x.lower()
  247. def allocateValue(self, nodeset):
  248. dataTypeNode = nodeset.getDataTypeNode(self.dataType)
  249. if dataTypeNode is None:
  250. return False
  251. # FIXME: Don't build at all or allocate "defaults"? I'm for not building at all.
  252. if self.xmlValueDef == None:
  253. #logger.warn("Variable " + self.browseName() + "/" + str(self.id()) + " is not initialized. No memory will be allocated.")
  254. return False
  255. self.value = Value()
  256. self.value.parseXMLEncoding(self.xmlValueDef, dataTypeNode, self)
  257. # Array Dimensions must accurately represent the value and will be patched
  258. # reflect the exaxt dimensions attached binary stream.
  259. if not isinstance(self.value, Value) or len(self.value.value) == 0:
  260. self.arrayDimensions = []
  261. return True
  262. class VariableTypeNode(VariableNode):
  263. def __init__(self, xmlelement=None):
  264. VariableNode.__init__(self)
  265. self.isAbstract = False
  266. if xmlelement:
  267. self.parseXML(xmlelement)
  268. def parseXML(self, xmlelement):
  269. Node.parseXML(self, xmlelement)
  270. for (at, av) in xmlelement.attributes.items():
  271. if at == "IsAbstract":
  272. self.isAbstract = "false" not in av.lower()
  273. class MethodNode(Node):
  274. def __init__(self, xmlelement=None):
  275. Node.__init__(self)
  276. self.executable = True
  277. self.userExecutable = True
  278. self.methodDecalaration = None
  279. if xmlelement:
  280. self.parseXML(xmlelement)
  281. def parseXML(self, xmlelement):
  282. Node.parseXML(self, xmlelement)
  283. for (at, av) in xmlelement.attributes.items():
  284. if at == "Executable":
  285. self.executable = "false" not in av.lower()
  286. if at == "UserExecutable":
  287. self.userExecutable = "false" not in av.lower()
  288. if at == "MethodDeclarationId":
  289. self.methodDeclaration = str(av)
  290. class ObjectTypeNode(Node):
  291. def __init__(self, xmlelement=None):
  292. Node.__init__(self)
  293. self.isAbstract = False
  294. if xmlelement:
  295. self.parseXML(xmlelement)
  296. def parseXML(self, xmlelement):
  297. Node.parseXML(self, xmlelement)
  298. for (at, av) in xmlelement.attributes.items():
  299. if at == "IsAbstract":
  300. self.isAbstract = "false" not in av.lower()
  301. class DataTypeNode(Node):
  302. """ DataTypeNode is a subtype of Node describing DataType nodes.
  303. DataType contain definitions and structure information usable for Variables.
  304. The format of this structure is determined by buildEncoding()
  305. Two definition styles are distinguished in XML:
  306. 1) A DataType can be a structure of fields, each field having a name and a type.
  307. The type must be either an encodable builtin node (ex. UInt32) or point to
  308. another DataType node that inherits its encoding from a builtin type using
  309. a inverse "hasSubtype" (hasSuperType) reference.
  310. 2) A DataType may be an enumeration, in which each field has a name and a numeric
  311. value.
  312. The definition is stored as an ordered list of tuples. Depending on which
  313. definition style was used, the __definition__ will hold
  314. 1) A list of ("Fieldname", Node) tuples.
  315. 2) A list of ("Fieldname", int) tuples.
  316. A DataType (and in consequence all Variables using it) shall be deemed not
  317. encodable if any of its fields cannot be traced to an encodable builtin type.
  318. A DataType shall be further deemed not encodable if it contains mixed structure/
  319. enumaration definitions.
  320. If encodable, the encoding can be retrieved using getEncoding().
  321. """
  322. __isEnum__ = False
  323. __xmlDefinition__ = None
  324. __baseTypeEncoding__ = []
  325. __encodable__ = False
  326. __encodingBuilt__ = False
  327. __definition__ = []
  328. def __init__(self, xmlelement=None):
  329. Node.__init__(self)
  330. self.isAbstract = False
  331. self.__xmlDefinition__ = None
  332. self.__baseTypeEncoding__ = []
  333. self.__encodable__ = None
  334. self.__encodingBuilt__ = False
  335. self.__definition__ = []
  336. self.__isEnum__ = False
  337. if xmlelement:
  338. self.parseXML(xmlelement)
  339. def parseXML(self, xmlelement):
  340. Node.parseXML(self, xmlelement)
  341. for (at, av) in xmlelement.attributes.items():
  342. if at == "IsAbstract":
  343. self.isAbstract = "false" not in av.lower()
  344. for x in xmlelement.childNodes:
  345. if x.nodeType == x.ELEMENT_NODE:
  346. if x.localName == "Definition":
  347. self.__xmlDefinition__ = x
  348. def isEncodable(self):
  349. """ Will return True if buildEncoding() was able to determine which builtin
  350. type corresponds to all fields of this DataType.
  351. If no encoding has been build yet, this function will call buildEncoding()
  352. and return True if it succeeds.
  353. """
  354. return self.__encodable__
  355. def getEncoding(self):
  356. """ If the dataType is encodable, getEncoding() returns a nested list
  357. containing the encoding the structure definition for this type.
  358. If no encoding has been build yet, this function will call buildEncoding()
  359. and return the encoding if buildEncoding() succeeds.
  360. If buildEncoding() fails or has failed, an empty list will be returned.
  361. """
  362. if self.__encodable__ == False:
  363. if self.__encodingBuilt__ == False:
  364. return self.buildEncoding()
  365. return []
  366. else:
  367. return self.__baseTypeEncoding__
  368. def buildEncoding(self, nodeset, indent=0, force=False):
  369. """ buildEncoding() determines the structure and aliases used for variables
  370. of this DataType.
  371. The function will parse the XML <Definition> of the dataType and extract
  372. "Name"-"Type" tuples. If successful, buildEncoding will return a nested
  373. list of the following format:
  374. [['Alias1', ['Alias2', ['BuiltinType']]], [Alias2, ['BuiltinType']], ...]
  375. Aliases are fieldnames defined by this DataType or DataTypes referenced. A
  376. list such as ['DataPoint', ['Int32']] indicates that a value will encode
  377. an Int32 with the alias 'DataPoint' such as <DataPoint>12827</DataPoint>.
  378. Only the first Alias of a nested list is considered valid for the BuiltinType.
  379. Single-Elemented lists are always BuiltinTypes. Every nested list must
  380. converge in a builtin type to be encodable. buildEncoding will follow
  381. the first type inheritance reference (hasSupertype) of the dataType if
  382. necessary;
  383. If instead to "DataType" a numeric "Value" attribute is encountered,
  384. the DataType will be considered an enumeration and all Variables using
  385. it will be encoded as Int32.
  386. DataTypes can be either structures or enumeration - mixed definitions will
  387. be unencodable.
  388. Calls to getEncoding() will be iterative. buildEncoding() can be called
  389. only once per dataType, with all following calls returning the predetermined
  390. value. Use of the 'force=True' parameter will force the Definition to be
  391. reparsed.
  392. After parsing, __definition__ holds the field definition as a list. Note
  393. that this might deviate from the encoding, especially if inheritance was
  394. used.
  395. """
  396. prefix = " " + "|"*indent+ "+"
  397. if force==True:
  398. self.__encodingBuilt__ = False
  399. if self.__encodingBuilt__ == True:
  400. if self.isEncodable():
  401. logger.debug(prefix + str(self.__baseTypeEncoding__) + " (already analyzed)")
  402. else:
  403. logger.debug( prefix + str(self.__baseTypeEncoding__) + "(already analyzed, not encodable!)")
  404. return self.__baseTypeEncoding__
  405. self.__encodingBuilt__ = True # signify that we have attempted to built this type
  406. self.__encodable__ = True
  407. if indent==0:
  408. logger.debug("Parsing DataType " + str(self.browseName) + " (" + str(self.id) + ")")
  409. if valueIsInternalType(self.browseName.name):
  410. self.__baseTypeEncoding__ = [self.browseName.name]
  411. self.__encodable__ = True
  412. logger.debug( prefix + str(self.browseName) + "*")
  413. logger.debug("Encodable as: " + str(self.__baseTypeEncoding__))
  414. logger.debug("")
  415. return self.__baseTypeEncoding__
  416. if self.__xmlDefinition__ == None:
  417. # Check if there is a supertype available
  418. for ref in self.references:
  419. if ref.isForward:
  420. continue
  421. # hasSubtype
  422. if ref.referenceType.i == 45:
  423. targetNode = nodeset.nodes[ref.target]
  424. if targetNode is not None and isinstance(targetNode, DataTypeNode):
  425. logger.debug( prefix + "Attempting definition using supertype " + str(targetNode.browseName) + " for DataType " + " " + str(self.browseName))
  426. subenc = targetNode.buildEncoding(nodeset=nodeset, indent=indent+1)
  427. if not targetNode.isEncodable():
  428. self.__encodable__ = False
  429. break
  430. else:
  431. self.__baseTypeEncoding__ = self.__baseTypeEncoding__ + [self.browseName.name, subenc, None]
  432. if len(self.__baseTypeEncoding__) == 0:
  433. logger.debug(prefix + "No viable definition for " + str(self.browseName) + " " + str(self.id) + " found.")
  434. self.__encodable__ = False
  435. if indent==0:
  436. if not self.__encodable__:
  437. logger.debug("Not encodable (partial): " + str(self.__baseTypeEncoding__))
  438. else:
  439. logger.debug("Encodable as: " + str(self.__baseTypeEncoding__))
  440. logger.debug( "")
  441. return self.__baseTypeEncoding__
  442. isEnum = True
  443. isSubType = True
  444. # We need to store the definition as ordered data, but can't use orderedDict
  445. # for backward compatibility with Python 2.6 and 3.4
  446. enumDict = []
  447. typeDict = []
  448. # An XML Definition is provided and will be parsed... now
  449. for x in self.__xmlDefinition__.childNodes:
  450. if x.nodeType == x.ELEMENT_NODE:
  451. fname = ""
  452. fdtype = ""
  453. enumVal = ""
  454. valueRank = None
  455. for at,av in x.attributes.items():
  456. if at == "DataType":
  457. fdtype = str(av)
  458. if fdtype in nodeset.aliases:
  459. fdtype = nodeset.aliases[fdtype]
  460. isEnum = False
  461. elif at == "Name":
  462. fname = str(av)
  463. elif at == "Value":
  464. enumVal = int(av)
  465. isSubType = False
  466. elif at == "ValueRank":
  467. valueRank = int(av)
  468. else:
  469. logger.warn("Unknown Field Attribute " + str(at))
  470. # This can either be an enumeration OR a structure, not both.
  471. # Figure out which of the dictionaries gets the newly read value pair
  472. if isEnum == isSubType:
  473. # This is an error
  474. logger.warn("DataType contains both enumeration and subtype (or neither)")
  475. self.__encodable__ = False
  476. break
  477. elif isEnum:
  478. # This is an enumeration
  479. enumDict.append((fname, enumVal))
  480. continue
  481. else:
  482. if fdtype == "":
  483. # If no datatype given use base datatype
  484. fdtype = "i=24"
  485. # This might be a subtype... follow the node defined as datatype to find out
  486. # what encoding to use
  487. fdTypeNodeId = NodeId(fdtype)
  488. fdTypeNodeId.ns = nodeset.namespaceMapping[self.modelUri][fdTypeNodeId.ns]
  489. if not fdTypeNodeId in nodeset.nodes:
  490. raise Exception("Node {} not found in nodeset".format(fdTypeNodeId))
  491. dtnode = nodeset.nodes[fdTypeNodeId]
  492. # The node in the datatype element was found. we inherit its encoding,
  493. # but must still ensure that the dtnode is itself validly encodable
  494. typeDict.append([fname, dtnode])
  495. fdtype = str(dtnode.browseName.name)
  496. logger.debug( prefix + fname + " : " + fdtype + " -> " + str(dtnode.id))
  497. subenc = dtnode.buildEncoding(nodeset=nodeset, indent=indent+1)
  498. self.__baseTypeEncoding__ = self.__baseTypeEncoding__ + [[fname, subenc, valueRank]]
  499. if not dtnode.isEncodable():
  500. # If we inherit an encoding from an unencodable not, this node is
  501. # also not encodable
  502. self.__encodable__ = False
  503. break
  504. # If we used inheritance to determine an encoding without alias, there is a
  505. # the possibility that lists got double-nested despite of only one element
  506. # being encoded, such as [['Int32']] or [['alias',['int32']]]. Remove that
  507. # enclosing list.
  508. while len(self.__baseTypeEncoding__) == 1 and isinstance(self.__baseTypeEncoding__[0], list):
  509. self.__baseTypeEncoding__ = self.__baseTypeEncoding__[0]
  510. if isEnum == True:
  511. self.__baseTypeEncoding__ = self.__baseTypeEncoding__ + ['Int32']
  512. self.__definition__ = enumDict
  513. self.__isEnum__ = True
  514. logger.debug( prefix+"Int32* -> enumeration with dictionary " + str(enumDict) + " encodable " + str(self.__encodable__))
  515. return self.__baseTypeEncoding__
  516. if indent==0:
  517. if not self.__encodable__:
  518. logger.debug( "Not encodable (partial): " + str(self.__baseTypeEncoding__))
  519. else:
  520. logger.debug( "Encodable as: " + str(self.__baseTypeEncoding__))
  521. self.__isEnum__ = False
  522. self.__definition__ = typeDict
  523. logger.debug( "")
  524. return self.__baseTypeEncoding__
  525. class ViewNode(Node):
  526. def __init__(self, xmlelement=None):
  527. Node.__init__(self)
  528. self.containsNoLoops == False
  529. self.eventNotifier == False
  530. if xmlelement:
  531. self.parseXML(xmlelement)
  532. def parseXML(self, xmlelement):
  533. Node.parseXML(self, xmlelement)
  534. for (at, av) in xmlelement.attributes.items():
  535. if at == "ContainsNoLoops":
  536. self.containsNoLoops = "false" not in av.lower()
  537. if at == "EventNotifier":
  538. self.eventNotifier = "false" not in av.lower()