class Flight(xsd.ComplexType): tail_number = xsd.Attribute(xsd.String) type = xsd.Attribute(xsd.Integer, use=xsd.Use.OPTIONAL) takeoff_airport = xsd.Element(Airport) takeoff_datetime = xsd.Element(xsd.DateTime, minOccurs=0) landing_airport = xsd.Element(Airport) landing_datetime = xsd.Element(xsd.DateTime, minOccurs=0)
def test_attribute_nil(self): mixed = xsd.Attribute(xsd.Boolean, nillable=True, use=xsd.Use.OPTIONAL) xmlelement = etree.Element('complexType') mixed.render(xmlelement, 'mixed', xsd.NIL) expected_xml = b'<complexType mixed="nil"/>\n' xml = etree.tostring(xmlelement, pretty_print=True) self.assertEqual(expected_xml, xml)
def test_attribute_false(self): mixed = xsd.Attribute(xsd.Boolean) xmlelement = etree.Element('complexType') mixed.render(xmlelement, 'mixed', True) expected_xml = b'<complexType mixed="true"/>\n' xml = etree.tostring(xmlelement, pretty_print=True) self.assertEqual(expected_xml, xml)
class AsyncProcessingStatusData(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence # Id = xsd.Attribute(xsd.ID, use=xsd.Use.OPTIONAL) Id = xsd.Attribute(xsd.String, use=xsd.Use.OPTIONAL) AsyncProcessingStatus = xsd.Ref(__name__ + '.AsyncProcessingStatus') @classmethod def create(cls, AsyncProcessingStatus): instance = cls() instance.AsyncProcessingStatus = AsyncProcessingStatus return instance
class MessageTypeSelector(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence # Id = xsd.Attribute(xsd.ID, use=xsd.Use.OPTIONAL) Id = xsd.Attribute(xsd.String, use=xsd.Use.OPTIONAL) NamespaceURI = xsd.Element(xsd.AnyURI, minOccurs=0) # RootElementLocalName = xsd.Element(xsd.NCName, minOccurs=0) RootElementLocalName = xsd.Element(xsd.String, minOccurs=0) Timestamp = xsd.Element(xsd.DateTime) NodeID = xsd.Element(xsd.String, minOccurs=0) @classmethod def create(cls, Timestamp): instance = cls() instance.Timestamp = Timestamp return instance
class MessageMetadata(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence # Id = xsd.Attribute(xsd.ID, use=xsd.Use.OPTIONAL) Id = xsd.Attribute(xsd.String, use=xsd.Use.OPTIONAL) MessageId = xsd.Element(xsd.String, minOccurs=0) MessageType = xsd.Element(MessageTypeType) SendingTimestamp = xsd.Element(xsd.DateTime) DeliveryTimestamp = xsd.Element(xsd.DateTime, minOccurs=0) Status = xsd.Element(__name__ + '.InteractionStatusType', minOccurs=0) @classmethod def create(cls, MessageType, SendingTimestamp): instance = cls() instance.MessageType = MessageType instance.SendingTimestamp = SendingTimestamp return instance
class SenderProvidedResponseData(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence # Id = xsd.Attribute(xsd.ID, use=xsd.Use.OPTIONAL) Id = xsd.Attribute(xsd.String, use=xsd.Use.OPTIONAL) MessageID = xsd.Element(xsd.String) To = xsd.Element(xsd.String) MessagePrimaryContent = xsd.Ref(__name__ + '.MessagePrimaryContent') PersonalSignature = xsd.Element(__name__ + '.XMLDSigSignatureType', minOccurs=0) AttachmentHeaderList = xsd.Ref(__name__ + '.AttachmentHeaderList') RefAttachmentHeaderList = xsd.Ref(__name__ + '.RefAttachmentHeaderList') AsyncProcessingStatus = xsd.Ref(__name__ + '.AsyncProcessingStatus') @classmethod def create(cls, MessageID, To): instance = cls() instance.MessageID = MessageID instance.To = To return instance
class Request(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence # Id = xsd.Attribute(xsd.ID, use=xsd.Use.OPTIONAL) Id = xsd.Attribute(xsd.String, use=xsd.Use.OPTIONAL) SenderProvidedRequestData = xsd.Ref(__name__ + '.SenderProvidedRequestData') MessageMetadata = xsd.Ref(__name__ + '.MessageMetadata') FSAttachmentsList = xsd.Ref(__name__ + '.FSAttachmentsList') ReplyTo = xsd.Element(xsd.String, minOccurs=0) SenderInformationSystemSignature = xsd.Element(__name__ + '.XMLDSigSignatureType', minOccurs=0) @classmethod def create(cls, SenderProvidedRequestData, MessageMetadata): instance = cls() instance.SenderProvidedRequestData = SenderProvidedRequestData instance.MessageMetadata = MessageMetadata return instance
class SenderProvidedRequestData(xsd.ComplexType): INHERITANCE = None INDICATOR = xsd.Sequence # Id = xsd.Attribute(xsd.ID, use=xsd.Use.OPTIONAL) Id = xsd.Attribute(xsd.String, use=xsd.Use.OPTIONAL) MessageID = xsd.Element(xsd.String) ReferenceMessageID = xsd.Element(xsd.String, minOccurs=0) TransactionCode = xsd.Element(xsd.String, minOccurs=0) NodeID = xsd.Element(xsd.String, minOccurs=0) EOL = xsd.Element(xsd.DateTime, minOccurs=0) MessagePrimaryContent = xsd.Ref(__name__ + '.MessagePrimaryContent') PersonalSignature = xsd.Element(__name__ + '.XMLDSigSignatureType', minOccurs=0) AttachmentHeaderList = xsd.Ref(__name__ + '.AttachmentHeaderList') RefAttachmentHeaderList = xsd.Ref(__name__ + '.RefAttachmentHeaderList') TestMessage = xsd.Element(__name__ + '.Void', minOccurs=0) @classmethod def create(cls, MessageID, MessagePrimaryContent): instance = cls() instance.MessageID = MessageID instance.MessagePrimaryContent = MessagePrimaryContent return instance
class Test(xsd.ComplexType): value = xsd.Attribute(xsd.String, nillable=True, use=xsd.Use.OPTIONAL)
class TBody(xsd.ComplexType): parts = xsd.Attribute(xsd.String) tBodyAttributes = xsd.Ref(TBodyAttributes)
class TBodyAttributes(xsd.AttributeGroup): encodingStyle = xsd.Attribute(xsd.String, use=xsd.Use.OPTIONAL) use = xsd.Attribute(xsd.String) namespace = xsd.Attribute(xsd.String)
class A(xsd.ComplexType): name = xsd.Attribute(xsd.String)
class B(A): type = xsd.Attribute(xsd.String)
class Aircraft(xsd.ComplexType): tail_number = xsd.Attribute(xsd.String)