Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
Marshall.handlers.atxml.XmlNamespace Class Reference
Collaboration diagram for Marshall.handlers.atxml.XmlNamespace:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def getAttributeByName
def getRelaxNG
def getATFields
def serialize
def deserialize
def processXml
def processXmlEnd
def getSchemaInfo

Static Public Attributes

 uses_at_fields = False
 the framework does a bit of introspection on namespaces for some attributes, defined below
string xmlns = "http://example.com"
string prefix = "xxx"

Detailed Description

Definition at line 97 of file atxml.py.


Constructor & Destructor Documentation

Definition at line 116 of file atxml.py.

00116 
00117     def __init__(self):
00118         for attribute in self.attributes:
00119             attribute.setNamespace( self )


Member Function Documentation

def Marshall.handlers.atxml.XmlNamespace.deserialize (   self,
  instance,
  ns_data,
  options 
)
given the instance and the namespace data for
instance, reconstitute this namespace's attributes
on the instance.

Definition at line 148 of file atxml.py.

00148 
00149     def deserialize(self, instance, ns_data, options):
00150         """ given the instance and the namespace data for
00151         instance, reconstitute this namespace's attributes
00152         on the instance.
00153         """
00154         if not ns_data:
00155             return 
00156         for attribute in self.attributes:
00157             try:
00158                 attribute.deserialize( instance, ns_data )
00159             except Exception, e:                
00160                 ec, e, tb = sys.exc_info()
00161                 ftb = traceback.format_tb(tb,)
00162                 msg = "failure while demarshalling schema attribute %s\n" % \
00163                       attribute.name 
00164                 msg += "data: %s\n" % ns_data.get(attribute.name, None)
00165                 msg += "original exception: %s\n" % str(ec)
00166                 msg += "original traceback:\n%s" % '\n'.join(ftb)
00167                 raise SchemaAttributeDemarshallException, msg
00168                 

return the at schema field names which are
handled by this namespace, this is utilized by
the AT namespace so it doesn't also handle these
fields. 

Definition at line 134 of file atxml.py.

00134 
00135     def getATFields(self):
00136         """ return the at schema field names which are
00137         handled by this namespace, this is utilized by
00138         the AT namespace so it doesn't also handle these
00139         fields. """
00140         raise NotImplemented("Subclass Responsiblity")

given an xml name return the schema attribute

Definition at line 120 of file atxml.py.

00120 
00121     def getAttributeByName(self, name):
00122         """ given an xml name return the schema attribute
00123         """
00124         for attribute in self.attributes:
00125             if attribute.name == name:
00126                 return attribute
00127         return None

Here is the caller graph for this function:

get the relaxng fragment that defines
whats in the namespace

Definition at line 128 of file atxml.py.

00128 
00129     def getRelaxNG(self):
00130         """ get the relaxng fragment that defines
00131         whats in the namespace
00132         """
00133         raise NotImplemented("Subclass Responsiblity")

return information on this namespace's rng schema

should be an iterable of sets of ( 'defined_name', 'occurence', 'schema')
where defined name is the name of any top level defined entities in
the schema, occurence defines the rng occurence value for that entity
in the object's xml representation, and schema is the rng schema
definition for the defined entities

Definition at line 188 of file atxml.py.

00188 
00189     def getSchemaInfo( self ):
00190         """ return information on this namespace's rng schema
00191 
00192         should be an iterable of sets of ( 'defined_name', 'occurence', 'schema')
00193         where defined name is the name of any top level defined entities in
00194         the schema, occurence defines the rng occurence value for that entity
00195         in the object's xml representation, and schema is the rng schema
00196         definition for the defined entities
00197         """
00198         return ()
00199     
00200     
00201         
00202     

def Marshall.handlers.atxml.XmlNamespace.processXml (   self,
  context,
  node 
)
handle the start of a xml tag with this namespace
the namespace and the name of the tag are bound to node.

if this method return false then the node is assumed to
be junk and it is discarded.

Definition at line 169 of file atxml.py.

00169 
00170     def processXml(self, context, node):
00171         """ handle the start of a xml tag with this namespace
00172         the namespace and the name of the tag are bound to node.
00173 
00174         if this method return false then the node is assumed to
00175         be junk and it is discarded.
00176         """ 
00177         tag, ns = utils.fixtag(node.tag,context.ns_map)
00178         attribute = self.getAttributeByName( tag )
00179         if attribute is None:
00180             return False
00181         node.attribute = attribute
00182         return attribute.processXml( context, node)

Here is the call graph for this function:

def Marshall.handlers.atxml.XmlNamespace.processXmlEnd (   self,
  name,
  context 
)
callback invoked when the parser reaches the
end of an xml node in this namespace.

Definition at line 183 of file atxml.py.

00183 
00184     def processXmlEnd(self, name, context):
00185         """ callback invoked when the parser reaches the
00186         end of an xml node in this namespace.
00187         """

def Marshall.handlers.atxml.XmlNamespace.serialize (   self,
  dom_node,
  parent_node,
  instance,
  options 
)
serialize the instance values to xml
based on attributes in this namespace

Definition at line 141 of file atxml.py.

00141 
00142     def serialize(self, dom_node, parent_node, instance, options):
00143         """ serialize the instance values to xml
00144         based on attributes in this namespace
00145         """
00146         for attribute in self.attributes:
00147             attribute.serialize( dom_node, parent_node, instance)


Member Data Documentation

Definition at line 113 of file atxml.py.

the framework does a bit of introspection on namespaces for some attributes, defined below

Definition at line 107 of file atxml.py.

string Marshall.handlers.atxml.XmlNamespace.xmlns = "http://example.com" [static]

Definition at line 110 of file atxml.py.


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