Package suds :: Package mx :: Module typer :: Class Typer
[hide private]
[frames] | no frames]

Class Typer

source code

Provides XML node typing as either automatic or manual.

Class Methods [hide private]
sax.element.Element
auto(cls, node, value=None)
Automatically set the node's xsi:type attribute based on either value's class or the class of the node's text.
source code
sax.element.Element
manual(cls, node, tval, ns=None)
Set the node's xsi:type attribute based on either value's class or the class of the node's text.
source code
 
genprefix(cls, node, ns)
Generate a prefix.
source code
 
known(cls, object) source code
Class Variables [hide private]
dict types = {<type 'bool'>: ('boolean', ('xs', 'http://www.w3.org/...
A dict of class to xs type mapping.
Method Details [hide private]

auto(cls, node, value=None)
Class Method

source code 

Automatically set the node's xsi:type attribute based on either value's class or the class of the node's text. When value is an unmapped class, the default type (xs:any) is set.

Parameters:
  • node (sax.element.Element) - An XML node
  • value (any) - An object that is or would be the node's text.
Returns: sax.element.Element
The specified node.

manual(cls, node, tval, ns=None)
Class Method

source code 

Set the node's xsi:type attribute based on either value's class or the class of the node's text. Then adds the referenced prefix(s) to the node's prefix mapping.

Parameters:
  • node (sax.element.Element) - An XML node
  • tval (str) - The name of the schema type.
  • ns ((prefix, uri)) - The XML namespace of tval.
Returns: sax.element.Element
The specified node.

genprefix(cls, node, ns)
Class Method

source code 

Generate a prefix.

Parameters:
  • node (sax.element.Element) - An XML node on which the prefix will be used.
  • ns ((prefix, uri)) - A namespace needing an unique prefix.
Returns:
The ns with a new prefix.

Class Variable Details [hide private]

types

A dict of class to xs type mapping.
Type:
dict
Value:
{<type 'bool'>: ('boolean',
                 ('xs', 'http://www.w3.org/2001/XMLSchema')),
 <type 'float'>: ('float', ('xs', 'http://www.w3.org/2001/XMLSchema'))\
,
 <type 'int'>: ('int', ('xs', 'http://www.w3.org/2001/XMLSchema')),
 <type 'long'>: ('long', ('xs', 'http://www.w3.org/2001/XMLSchema')),
 <type 'str'>: ('string', ('xs', 'http://www.w3.org/2001/XMLSchema')),
 <type 'unicode'>: ('string', ('xs', 'http://www.w3.org/2001/XMLSchema\
...