suds.mx package¶
Submodules¶
suds.mx.appender module¶
Provides appender classes for marshalling.
-
class
suds.mx.appender.Appender(marshaller)¶ Bases:
objectAn appender used by the marshaller to append content. :ivar marshaller: A marshaller. :type marshaller:
suds.mx.core.Core-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
node(content)¶ Create and return an XML node that is qualified using the
type. Also, make sure all referenced namespace prefixes are declared. :param content: The content for which processing has ended. :type content:Object:return: A new node. :rtype:Element
-
optional(content)¶ Get whether the specified content is optional. :param content: The content which to check. :type content:
Content
-
resume(content)¶ Notify
marshallerthat appending this content has resumed. :param content: The content for which processing has been resumed. :type content:Object
-
setdefault(node, content)¶ Set the value of the
nodeto a default value. :param node: Anilnode. :type node:Element:param content: The content for which processing has ended. :type content:Object:return: The default.
-
setnil(node, content)¶ Set the value of the
nodeto nill. :param node: Anilnode. :type node:Element:param content: The content for which processing has ended. :type content:Object
-
suspend(content)¶ Notify
marshallerthat appending this content has suspended. :param content: The content for which processing has been suspended. :type content:Object
-
-
class
suds.mx.appender.ContentAppender(marshaller)¶ Bases:
objectAppender used to add content to marshalled objects. :ivar default: The default appender. :type default:
Appender:ivar appenders: Atableof appenders mapped by class. :type appenders:table-
append(parent, content)¶ Select an appender and append the content to parent. :param parent: A parent node. :type parent:
Element:param content: The content to append. :type content:Content
-
-
class
suds.mx.appender.ElementAppender(marshaller)¶ Bases:
suds.mx.appender.AppenderAn appender for
Elementtypes.-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
-
class
suds.mx.appender.ElementWrapper(content)¶ Bases:
suds.sax.element.ElementElement wrapper.
-
str(indent=0)¶ Get a string representation of this XML fragment.
Parameters: indent (int) – The indent to be used in formatting the output. Returns: A prettystring.Return type: basestring
-
-
class
suds.mx.appender.ListAppender(marshaller)¶ Bases:
suds.mx.appender.AppenderA list/tuple appender.
-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
-
class
suds.mx.appender.Matcher(cls)¶ Bases:
objectAppender matcher. :ivar cls: A class object. :type cls:
classobj
-
class
suds.mx.appender.NoneAppender(marshaller)¶ Bases:
suds.mx.appender.AppenderAn appender for
Nonevalues.-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
-
class
suds.mx.appender.ObjectAppender(marshaller)¶ Bases:
suds.mx.appender.AppenderAn
Objectappender.-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
-
class
suds.mx.appender.PrimitiveAppender(marshaller)¶ Bases:
suds.mx.appender.AppenderAn appender for python
primitivetypes.-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
-
class
suds.mx.appender.PropertyAppender(marshaller)¶ Bases:
suds.mx.appender.AppenderA
Propertyappender.-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
-
class
suds.mx.appender.TextAppender(marshaller)¶ Bases:
suds.mx.appender.AppenderAn appender for
Textvalues.-
append(parent, content)¶ Append the specified
contentto theparent. :param content: The content to append. :type content:Object
-
suds.mx.basic module¶
Provides basic marshaller classes.
-
class
suds.mx.basic.Basic¶ Bases:
suds.mx.core.CoreA
basic(untyped) marshaller.-
process(value, tag=None)¶ Process (marshal) the tag with the specified value using the optional type information. :param value: The value (content) of the XML node. :type value: (:class:`Object`|any) :param tag: The (optional) tag name for the value. The default is
value.__class__.__name__Returns: An xml node. Return type: Element
-
suds.mx.core module¶
Provides marshaller core classes.
-
class
suds.mx.core.Core¶ Bases:
objectAn
abstractmarshaller. This class implement the core functionality of the marshaller. :ivar appender: A content appender. :type appender:ContentAppender-
append(parent, content)¶ Append the specified
contentto theparent. :param parent: The parent node to append to. :type parent:Element:param content: The content to append. :type content:Object
-
end(parent, content)¶ Appending this content has ended. :param parent: The parent node ending. :type parent:
Element:param content: The content for which processing has ended. :type content:Content
-
node(content)¶ Create and return an XML node. :param content: Content information for the new node. :type content:
Content:return: An element. :rtype:Element
-
optional(content)¶ Get whether the specified content is optional. :param content: The content which to check. :type content:
Content
-
process(content)¶ Process (marshal) the tag with the specified value using the optional type information. :param content: The content to process. :type content:
Object
-
reset()¶ Reset the marshaller.
-
resume(content)¶ Appending this content has resumed. :param content: The content for which processing has been resumed. :type content:
Content
-
setdefault(node, content)¶ Set the value of the
nodeto a default value. :param node: Anilnode. :type node:Element:param content: The content to set the default value. :type content:Content:return: The default.
-
setnil(node, content)¶ Set the value of the
nodeto nill. :param node: Anilnode. :type node:Element:param content: The content to set nil. :type content:Content
-
start(content)¶ Appending this content has started. :param content: The content for which processing has started. :type content:
Content:return: True to continue appending :rtype: boolean
-
suspend(content)¶ Appending this content has suspended. :param content: The content for which processing has been suspended. :type content:
Content
-
suds.mx.encoded module¶
Provides encoded marshaller classes.
-
class
suds.mx.encoded.Encoded(schema, xstq=True)¶ Bases:
suds.mx.literal.LiteralA SOAP section (5) encoding marshaller. This marshaller supports rpc/encoded soap styles.
-
cast(content)¶ Cast the
untypedlist items found in contentvalue. Each items contained in the list is checked for XSD type information. Items (values) that areuntyped, are replaced with suds objects and typemetadatais added. :param content: The content holding the collection. :type content:Content:return: self :rtype:Encoded
-
encode(node, content)¶ Add (SOAP) encoding information if needed.
The encoding information is added only if the resolved type is derived by extension. Furthermore, the xsi:type value is qualified by namespace only if the content (tag) and referenced type are in different namespaces.
-
end(parent, content)¶ End processing the content.
Make sure the content ending matches the top of the resolver stack since for list processing we play games with the resolver stack.
-
start(content)¶ Start marshalling the ‘content’ by ensuring that both the ‘content’ _and_ the resolver are primed with the XSD type information. The ‘content’ value is both translated and sorted based on the XSD type. Only values that are objects have their attributes sorted.
-
suds.mx.literal module¶
Provides literal marshaller classes.
-
class
suds.mx.literal.Literal(schema, xstq=True)¶ Bases:
suds.mx.literal.TypedA
literalmarshaller.This marshaller is semi-typed as needed to support both
document/literalandrpc/literalsoap message styles.
-
class
suds.mx.literal.Typed(schema, xstq=True)¶ Bases:
suds.mx.core.CoreA
typedmarshaller.This marshaller is semi-typed as needed to support both
document/literalandrpc/literalSOAP message styles.Variables: -
encode(node, content)¶ Add (SOAP) encoding information if needed.
The encoding information is added only if the resolved type is derived by extension. Furthermore, the xsi:type value is qualified by namespace only if the content (tag) and referenced type are in different namespaces.
-
end(parent, content)¶ End processing the content.
Make sure the content ending matches the top of the resolver stack since for list processing we play games with the resolver stack.
-
node(content)¶ Create an XML node.
The XML node is namespace qualified as defined by the corresponding schema element.
-
optional(content)¶ Get whether the specified content is optional. :param content: The content which to check. :type content:
Content
-
ordering(type)¶ Attribute ordering defined in the specified XSD type information.
Parameters: type ( SchemaObject) – XSD type object.Returns: An ordered list of attribute names. Return type: list
-
reset()¶ Reset the marshaller.
-
resume(content)¶ Resume processing list content.
To do this, we really need to simply push the ‘list’ content back onto the resolver stack.
-
setdefault(node, content)¶ Set the node to the default value specified by the XSD type.
-
setnil(node, content)¶ Set the ‘node’ nil only if the XSD type specifies that it is permitted.
-
skip(content)¶ Get whether to skip this
content.Should be skipped when the content is optional and value is either None or an empty list.
Parameters: content ( Object) – Content to skip.Returns: True if content is to be skipped. Return type: bool
-
sort(content)¶ Sort suds object attributes.
The attributes are sorted based on the ordering defined in the XSD type information.
Parameters: content ( Object) – Content to sort.Returns: self Return type: Typed
-
start(content)¶ Start marshalling the ‘content’ by ensuring that both the ‘content’ _and_ the resolver are primed with the XSD type information. The ‘content’ value is both translated and sorted based on the XSD type. Only values that are objects have their attributes sorted.
-
suspend(content)¶ Suspend to process list content.
Primarily, this involves popping the ‘list’ content off the resolver’s stack so its list items can be marshalled.
-
suds.mx.typer module¶
Provides XSD typing classes.
-
class
suds.mx.typer.Typer¶ Bases:
objectProvides XML node typing as either automatic or manual.
Variables: types – Class to XSD type mapping. -
classmethod
auto(node, value=None)¶ Automatically set the node’s xsi:type attribute based on either
value’s or the node text’s class. Whenvalueis an unmapped class, the default type (xs:any) is set.Parameters: - node (
sax.element.Element) – XML node. - value (
any) – Object that is or would be the node’s text.
Returns: Specified node.
Return type: sax.element.Element- node (
-
classmethod
genprefix(node, ns)¶ Generate a prefix.
Parameters: - node (
sax.element.Element) – XML node on which the prefix will be used. - ns ((prefix, URI)) – Namespace needing a unique prefix.
Returns: nswith a new prefix.Return type: (prefix, URI)
- node (
-
classmethod
known(object)¶
-
classmethod
manual(node, tval, ns=None)¶ Set the node’s xsi:type attribute based on either
value’s or the node text’s class. Then adds the referenced prefix(s) to the node’s prefix mapping.Parameters: - node (
sax.element.Element) – XML node. - tval (str) – XSD schema type name.
- ns ((prefix, URI)) –
tvalXML namespace.
Returns: Specified node.
Return type: sax.element.Element- node (
-
types= {<class 'bool'>: ('boolean', ('xs', 'http://www.w3.org/2001/XMLSchema')), <class 'float'>: ('float', ('xs', 'http://www.w3.org/2001/XMLSchema')), <class 'int'>: ('long', ('xs', 'http://www.w3.org/2001/XMLSchema')), <class 'str'>: ('string', ('xs', 'http://www.w3.org/2001/XMLSchema')), <class 'suds.sax.text.Text'>: ('string', ('xs', 'http://www.w3.org/2001/XMLSchema'))}¶
-
classmethod
Module contents¶
Provides modules containing classes to support marshalling to XML.
-
class
suds.mx.Content(tag=None, value=None, **kwargs)¶ Bases:
suds.sudsobject.ObjectMarshaller content.
Variables: - tag – The content tag.
- value – The content’s value.
-
extensions= ['type', 'real', 'ancestry', 'aty']¶