gensrc.serialization.xmlreader.XmlReader Class Reference
Inheritance diagram for gensrc.serialization.xmlreader.XmlReader:
Collaboration diagram for gensrc.serialization.xmlreader.XmlReader:

Public Member Functions

def serializeValue (self, caller, valueName='value')
 public interface More...
 
def serializeAttribute (self, caller, attributeName, defaultValue=None)
 
def serializeAttributeInteger (self, caller, attributeName, defaultValue=None)
 
def serializeAttributeBoolean (self, caller, attributeName, defaultValue=None)
 
def serializeProperty (self, caller, propertyName, defaultValue=None)
 
def serializeBoolean (self, caller, propertyName, defaultValue=False)
 
def serializeList (self, caller, vectorName, itemName, allowNone=False)
 
def serializeDict (self, caller, dictName)
 
def serializeObject (self, caller, objectClass)
 
def serializeObjectList (self, caller, objectClass)
 
def serializeObjectDict (self, caller, objectClass)
 
def serializeObjectPropertyDict (self, caller, objectClass)
 
def __init__ (self, fileName)
 initialization More...
 
def getChild (self, tagName, allowNone=False)
 private member functions More...
 
def iterateChildren (self, node)
 
def isTextNode (self, node)
 
def getNodeValue (self, node)
 
def stringToBoolean (self, str)
 
def sub1 (self, m)
 
def formatIdentifier (self, identifier)
 
- Public Member Functions inherited from gensrc.serialization.serializer.Serializer
def __init__ (self)
 

Public Attributes

 node_
 
 documentName_
 

Static Public Attributes

 REGEX_FORMAT_ID = re.compile(r'^(\w)(\w.*)$')
 

Detailed Description

A class which implements the (De)Serializer interface to deserialize
a (De)Serializable object from an XML stream.

Constructor & Destructor Documentation

◆ __init__()

def gensrc.serialization.xmlreader.XmlReader.__init__ (   self,
  fileName 
)

initialization

Load indicated file into dom document.

Member Function Documentation

◆ formatIdentifier()

def gensrc.serialization.xmlreader.XmlReader.formatIdentifier (   self,
  identifier 
)
Convert a general identifier to an identifier that complies
to standards for a private variable name.

This function accepts an identifier, converts the first character
to lowercase, and suffixes an underscore.  For example the input
    VariableName
yields the output
    variableName_

◆ getChild()

def gensrc.serialization.xmlreader.XmlReader.getChild (   self,
  tagName,
  allowNone = False 
)

private member functions

Get single named child of current node.

◆ getNodeValue()

def gensrc.serialization.xmlreader.XmlReader.getNodeValue (   self,
  node 
)
Get value of text node.

◆ isTextNode()

def gensrc.serialization.xmlreader.XmlReader.isTextNode (   self,
  node 
)
Return True for element node with single child text node.

◆ iterateChildren()

def gensrc.serialization.xmlreader.XmlReader.iterateChildren (   self,
  node 
)
Iterate through children of given node, skipping child nodes which
are not part of the application level XML.

◆ serializeAttribute()

def gensrc.serialization.xmlreader.XmlReader.serializeAttribute (   self,
  caller,
  attributeName,
  defaultValue = None 
)
Read a named attribute.

◆ serializeAttributeBoolean()

def gensrc.serialization.xmlreader.XmlReader.serializeAttributeBoolean (   self,
  caller,
  attributeName,
  defaultValue = None 
)
Read a named boolean attribute.

◆ serializeAttributeInteger()

def gensrc.serialization.xmlreader.XmlReader.serializeAttributeInteger (   self,
  caller,
  attributeName,
  defaultValue = None 
)
Read a named integral attribute.

◆ serializeBoolean()

def gensrc.serialization.xmlreader.XmlReader.serializeBoolean (   self,
  caller,
  propertyName,
  defaultValue = False 
)
Read a named boolean property.

◆ serializeDict()

def gensrc.serialization.xmlreader.XmlReader.serializeDict (   self,
  caller,
  dictName 
)
Read a named element in the document and set its values as
attributes of the caller.

◆ serializeList()

def gensrc.serialization.xmlreader.XmlReader.serializeList (   self,
  caller,
  vectorName,
  itemName,
  allowNone = False 
)
Read a list of elements.

◆ serializeObject()

def gensrc.serialization.xmlreader.XmlReader.serializeObject (   self,
  caller,
  objectClass 
)
Load a Serializable object.

◆ serializeObjectDict()

def gensrc.serialization.xmlreader.XmlReader.serializeObjectDict (   self,
  caller,
  objectClass 
)
Load a named element and write its data as a property of the caller.

A client invokes this function as follows:
    serializer.serializeObjectDict(self, Foo)

And after the call returns, the caller's dict is populated as follows:
    self.Foo - a dict of objects, keyed by object identifier
    self.FooKeys - a sorted list of the object identifiers

These structures allow the caller to iterate through the objects
in order by identifier.

◆ serializeObjectList()

def gensrc.serialization.xmlreader.XmlReader.serializeObjectList (   self,
  caller,
  objectClass 
)
Load a list of Serializable objects.

◆ serializeObjectPropertyDict()

def gensrc.serialization.xmlreader.XmlReader.serializeObjectPropertyDict (   self,
  caller,
  objectClass 
)
Load a named element and write its children directly as
properties of the calling object.

A client invokes this function as follows:
    serializer.serializeObjectPropertyDict(self, Foo)

On XML data formatted as follows:
    <FooCollection>
<Foo name='fooIdentifier_1'/>
<Foo name='fooIdentifier_2'/>
...
<Foo name='fooIdentifier_n'/>
    </FooCollection>

And after this function returns, the calling object is populated as follows:
    self.fooIdentifier_1
    self.fooIdentifier_2
    ...
    self.fooIdentifier_n

This is appropriate when the caller knows at compile time the names
of the objects to be loaded.

◆ serializeProperty()

def gensrc.serialization.xmlreader.XmlReader.serializeProperty (   self,
  caller,
  propertyName,
  defaultValue = None 
)
Read a named property.

◆ serializeValue()

def gensrc.serialization.xmlreader.XmlReader.serializeValue (   self,
  caller,
  valueName = 'value' 
)

public interface

Read a value.

◆ stringToBoolean()

def gensrc.serialization.xmlreader.XmlReader.stringToBoolean (   self,
  str 
)
Convert text string to boolean.

◆ sub1()

def gensrc.serialization.xmlreader.XmlReader.sub1 (   self,
  m 
)
Convert input value from format InputValue to format
inputValue_.

The documentation for this class was generated from the following file:
  • xmlreader.py