Xml
The spyne.protocol.xml package contains an xml-based protocol that
serializes python objects to xml using Xml Schema conventions.
-
exception spyne.protocol.xml._base.SchemaValidationError(faultstring)[source]
Bases: spyne.model.fault.Fault
Raised when the input stream could not be validated by the Xml Schema.
-
class spyne.protocol.xml._base.XmlDocument(app=None, validator=None, xml_declaration=True, cleanup_namespaces=False)[source]
Bases: spyne.protocol._base.ProtocolBase
The Xml Schema serialization protocol.
See the following material for more (much much more!) information.
Parameters: |
- app – The owner application instance.
- validator – One of (None, ‘soft’, ‘lxml’, ‘schema’,
ProtocolBase.SOFT_VALIDATION, XmlDocument.SCHEMA_VALIDATION).
- xml_declaration – Whether to add xml_declaration to the responses
Default is ‘True’.
- cleanup_namespaces – Whether to add clean up namespace declarations
in the response document. Default is ‘False’.
|
-
SCHEMA_VALIDATION
alias of Schema
-
allowed_http_verbs = set(['POST', 'GET'])
-
create_in_document(ctx, charset=None)[source]
Uses the iterable of string fragments in ctx.in_string to set
ctx.in_document.
-
create_out_string(ctx, charset=None)[source]
Sets an iterable of string fragments to ctx.out_string
-
decompose_incoming_envelope(ctx, message)[source]
-
deserialize(ctx, message)[source]
Takes a MethodContext instance and a string containing ONE root xml
tag.
Returns the corresponding native python object
Not meant to be overridden.
-
from_element(cls, element)[source]
-
mime_type = 'text/xml'
-
serialize(ctx, message)[source]
Uses ctx.out_object, ctx.out_header or ctx.out_error to set
ctx.out_body_doc, ctx.out_header_doc and ctx.out_document as an
lxml.etree._Element instance.
Not meant to be overridden.
-
set_app(value)[source]
-
set_validator(validator)[source]
-
to_parent_element(cls, value, tns, parent_elt, *args, **kwargs)[source]
-
validate_body(ctx, message)[source]
Sets ctx.method_request_string and calls generate_contexts()
for validation.
-
spyne.protocol.xml._base.XmlObject
DEPRECATED. Use spyne.protocol.xml.XmlDocument instead
alias of XmlDocument