zeep.xsd

class zeep.xsd.schema.Schema(node=None, transport=None, location=None, settings=None)

A schema is a collection of schema documents.

create_new_document(node, url, base_url=None, target_namespace=None)
Return type

zeep.xsd.schema.SchemaDocument

property elements

Yield all globla xsd.Type objects

Return type

Iterable of zeep.xsd.Element

get_attribute(qname) zeep.xsd.elements.attribute.Attribute

Return a global xsd.attribute object with the given qname

get_attribute_group(qname) zeep.xsd.elements.attribute.AttributeGroup

Return a global xsd.attributeGroup object with the given qname

get_element(qname) zeep.xsd.elements.element.Element

Return a global xsd.Element object with the given qname

get_group(qname) zeep.xsd.elements.indicators.Group

Return a global xsd.Group object with the given qname.

get_type(qname, fail_silently=False)

Return a global xsd.Type object with the given qname

Return type

zeep.xsd.ComplexType or zeep.xsd.AnySimpleType

property is_empty

Boolean to indicate if this schema contains any types or elements

merge(schema)

Merge an other XSD schema in this one

property types

Yield all global xsd.Type objects

Return type

Iterable of zeep.xsd.ComplexType

class zeep.xsd.schema.SchemaDocument(namespace, location, base_url)

A Schema Document consists of a set of schema components for a specific target namespace.

This represents an xsd:Schema object

get_attribute(qname) zeep.xsd.elements.attribute.Attribute

Return a xsd.Attribute object from this schema

get_attribute_group(qname) zeep.xsd.elements.attribute.AttributeGroup

Return a xsd.AttributeGroup object from this schema

get_element(qname) zeep.xsd.elements.element.Element

Return a xsd.Element object from this schema

get_group(qname) zeep.xsd.elements.indicators.Group

Return a xsd.Group object from this schema

get_type(qname: lxml.etree.QName)

Return a xsd.Type object from this schema

Return type

zeep.xsd.ComplexType or zeep.xsd.AnySimpleType

load(schema, node)

Load the XML Schema passed in via the node attribute.

register_attribute(qname: str, value: zeep.xsd.elements.attribute.Attribute)

Register a xsd:Attribute in this schema

register_attribute_group(qname: lxml.etree.QName, value: zeep.xsd.elements.attribute.AttributeGroup) None

Register a xsd:AttributeGroup in this schema

register_element(qname: lxml.etree.QName, value: zeep.xsd.elements.element.Element)

Register a xsd.Element in this schema

register_group(qname: lxml.etree.QName, value: zeep.xsd.elements.indicators.Group)

Register a xsd:Group in this schema

register_import(namespace, schema)

Register an import for an other schema document.

register_type(qname: lxml.etree.QName, value: zeep.xsd.types.base.Type)

Register a xsd.Type in this schema

zeep.xsd.utils.create_prefixed_name(qname, schema)

Convert a QName to a xsd:name (‘ns1:myType’).

Return type

str

class zeep.xsd.valueobjects.AnyObject(xsd_object, value)

Create an any object

Parameters
  • xsd_object – the xsd type

  • value – The value

class zeep.xsd.valueobjects.CompoundValue(*args, **kwargs)

Represents a data object for a specific xsd:complexType.

class zeep.xsd.visitor.SchemaVisitor(schema, document)

Visitor which processes XSD files and registers global elements and types in the given schema.

Notes:

TODO: include and import statements can reference other nodes. We need to load these first. Always global.

Parameters
visit_all(node, parent)

Allows the elements in the group to appear (or not appear) in any order in the containing element.

Definition:

<all
  id = ID
  maxOccurs= 1: 1
  minOccurs= (0 | 1): 1
  {any attributes with non-schema Namespace...}>
Content: (annotation?, element*)
</all>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_annotation(node, parent)

Defines an annotation.

Definition:

<annotation
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (appinfo | documentation)*
</annotation>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_any(node, parent)

Definition:

<any
  id = ID
  maxOccurs = (nonNegativeInteger | unbounded) : 1
  minOccurs = nonNegativeInteger : 1
  namespace = "(##any | ##other) |
    List of (anyURI | (##targetNamespace |  ##local))) : ##any
  processContents = (lax | skip | strict) : strict
  {any attributes with non-schema Namespace...}>
Content: (annotation?)
</any>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_any_attribute(node, parent)

Definition:

<anyAttribute
  id = ID
  namespace = ((##any | ##other) |
    List of (anyURI | (##targetNamespace | ##local))) : ##any
  processContents = (lax | skip | strict): strict
  {any attributes with non-schema Namespace...}>
Content: (annotation?)
</anyAttribute>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_attribute(node: lxml.etree._Element, parent: lxml.etree._Element) Union[zeep.xsd.elements.attribute.Attribute, zeep.xsd.elements.references.RefAttribute]

Declares an attribute.

Definition:

<attribute
  default = string
  fixed = string
  form = (qualified | unqualified)
  id = ID
  name = NCName
  ref = QName
  type = QName
  use = (optional | prohibited | required): optional
  {any attributes with non-schema Namespace...}>
Content: (annotation?, (simpleType?))
</attribute>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_attribute_group(node, parent)

Definition:

<attributeGroup
  id = ID
  name = NCName
  ref = QName
  {any attributes with non-schema Namespace...}>
Content: (annotation?),
         ((attribute | attributeGroup)*, anyAttribute?))
</attributeGroup>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_choice(node, parent)

Definition:

<choice
  id = ID
  maxOccurs= (nonNegativeInteger | unbounded) : 1
  minOccurs= nonNegativeInteger : 1
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (element | group | choice | sequence | any)*)
</choice>
visit_complex_content(node, parent)

The complexContent element defines extensions or restrictions on a complex type that contains mixed content or elements only.

Definition:

<complexContent
  id = ID
  mixed = Boolean
  {any attributes with non-schema Namespace}...>
Content: (annotation?,  (restriction | extension))
</complexContent>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_complex_type(node, parent)

Definition:

<complexType
  abstract = Boolean : false
  block = (#all | List of (extension | restriction))
  final = (#all | List of (extension | restriction))
  id = ID
  mixed = Boolean : false
  name = NCName
  {any attributes with non-schema Namespace...}>
Content: (annotation?, (simpleContent | complexContent |
          ((group | all | choice | sequence)?,
          ((attribute | attributeGroup)*, anyAttribute?))))
</complexType>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_element(node, parent)

Definition:

<element
  abstract = Boolean : false
  block = (#all | List of (extension | restriction | substitution))
  default = string
  final = (#all | List of (extension | restriction))
  fixed = string
  form = (qualified | unqualified)
  id = ID
  maxOccurs = (nonNegativeInteger | unbounded) : 1
  minOccurs = nonNegativeInteger : 1
  name = NCName
  nillable = Boolean : false
  ref = QName
  substitutionGroup = QName
  type = QName
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (
          (simpleType | complexType)?, (unique | key | keyref)*))
</element>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_extension_complex_content(node, parent)

Definition:

<extension
  base = QName
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (
            (group | all | choice | sequence)?,
            ((attribute | attributeGroup)*, anyAttribute?)))
</extension>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_extension_simple_content(node, parent)

Definition:

<extension
  base = QName
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
</extension>
visit_group(node, parent)

Groups a set of element declarations so that they can be incorporated as a group into complex type definitions.

Definition:

<group
  name= NCName
  id = ID
  maxOccurs = (nonNegativeInteger | unbounded) : 1
  minOccurs = nonNegativeInteger : 1
  name = NCName
  ref = QName
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (all | choice | sequence))
</group>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_import(node, parent)

Definition:

<import
  id = ID
  namespace = anyURI
  schemaLocation = anyURI
  {any attributes with non-schema Namespace}...>
Content: (annotation?)
</import>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_include(node, parent)

Definition:

<include
  id = ID
  schemaLocation = anyURI
  {any attributes with non-schema Namespace}...>
Content: (annotation?)
</include>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_list(node, parent)

Definition:

<list
  id = ID
  itemType = QName
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (simpleType?))
</list>

The use of the simpleType element child and the itemType attribute is mutually exclusive.

Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_notation(node, parent)

Contains the definition of a notation to describe the format of non-XML data within an XML document. An XML Schema notation declaration is a reconstruction of XML 1.0 NOTATION declarations.

Definition:

<notation
  id = ID
  name = NCName
  public = Public identifier per ISO 8879
  system = anyURI
  {any attributes with non-schema Namespace}...>
Content: (annotation?)
</notation>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_restriction_complex_content(node, parent)

Definition:

<restriction
  base = QName
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (group | all | choice | sequence)?,
        ((attribute | attributeGroup)*, anyAttribute?))
</restriction>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_restriction_simple_content(node, parent)

Definition:

<restriction
  base = QName
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?,
    (simpleType?, (
        minExclusive | minInclusive | maxExclusive | maxInclusive |
        totalDigits |fractionDigits | length | minLength |
        maxLength | enumeration | whiteSpace | pattern)*
    )?, ((attribute | attributeGroup)*, anyAttribute?))
</restriction>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_restriction_simple_type(node, parent)

Definition:

<restriction
  base = QName
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?,
    (simpleType?, (
        minExclusive | minInclusive | maxExclusive | maxInclusive |
        totalDigits |fractionDigits | length | minLength |
        maxLength | enumeration | whiteSpace | pattern)*))
</restriction>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_schema(node)

Visit the xsd:schema element and process all the child elements

Definition:

<schema
  attributeFormDefault = (qualified | unqualified): unqualified
  blockDefault = (#all | List of (extension | restriction | substitution) : ''
  elementFormDefault = (qualified | unqualified): unqualified
  finalDefault = (#all | List of (extension | restriction | list | union): ''
  id = ID
  targetNamespace = anyURI
  version = token
  xml:lang = language
  {any attributes with non-schema Namespace}...>
Content: (
    (include | import | redefine | annotation)*,
    (((simpleType | complexType | group | attributeGroup) |
      element | attribute | notation),
     annotation*)*)
</schema>
Parameters

node (lxml.etree._Element) – The XML node

visit_sequence(node, parent)

Definition:

<sequence
  id = ID
  maxOccurs = (nonNegativeInteger | unbounded) : 1
  minOccurs = nonNegativeInteger : 1
  {any attributes with non-schema Namespace}...>
Content: (annotation?,
          (element | group | choice | sequence | any)*)
</sequence>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_simple_content(node, parent)

Contains extensions or restrictions on a complexType element with character data or a simpleType element as content and contains no elements.

Definition:

<simpleContent
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (restriction | extension))
</simpleContent>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_simple_type(node, parent)

Definition:

<simpleType
  final = (#all | (list | union | restriction))
  id = ID
  name = NCName
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (restriction | list | union))
</simpleType>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_union(node, parent)

Defines a collection of multiple simpleType definitions.

Definition:

<union
  id = ID
  memberTypes = List of QNames
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (simpleType*))
</union>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node

visit_unique(node, parent)

Specifies that an attribute or element value (or a combination of attribute or element values) must be unique within the specified scope. The value must be unique or nil.

Definition:

<unique
  id = ID
  name = NCName
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (selector, field+))
</unique>
Parameters
  • node (lxml.etree._Element) – The XML node

  • parent (lxml.etree._Element) – The parent XML node