Skip to content

Instantly share code, notes, and snippets.

@plq
Created April 3, 2012 14:24
Show Gist options
  • Save plq/2292401 to your computer and use it in GitHub Desktop.
Save plq/2292401 to your computer and use it in GitHub Desktop.
Any tag test case.
#!/usr/bin/env python
from lxml import etree
from rpclib.model.primitive import AnyXml
from rpclib.model.complex import ComplexModel
from rpclib.const import xml_ns as ns
from rpclib.util.xml import get_schema_documents
class SomeType(ComplexModel):
__namespace__ = "zo"
anything = AnyXml(schema_tag='{%s}any' % ns.xsd, namespace='##other',
process_contents='lax')
docs = get_schema_documents([SomeType])
print etree.tostring(docs['tns'], pretty_print=True)
<xs:schema xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing" xmlns:tns="zo" xmlns:plink="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:senc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s12env="http://www.w3.org/2003/05/soap-envelope/" xmlns:s12enc="http://www.w3.org/2003/05/soap-encoding/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="zo" elementFormDefault="qualified">
<xs:complexType name="SomeType">
<xs:sequence>
<xs:any namespace="##other" processContents="lax" minOccurs="0" nillable="true"/>
</xs:sequence>
</xs:complexType>
<xs:element name="SomeType" type="tns:SomeType"/>
</xs:schema>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment