Visual Basic 6 Sample : Derived By Extension
Schema Summary This sample shows how a complex type may be extended, and how the base and extended types can be manipulated in code. Schema Details The Schema A global base type Address is defined (all base types must be global). The elements CAN_Address and GBR_Address then extended Address in order to add additional elements. The Person element contains a child element HomeAddress of type Address. In place of Address any type that is based on Address (including Address itself) can be used (CAN_Address and GBR_Address). If an element is added to Person:HomeAddress of a type other than the Address, then we need to identify the type of the element used (for validation purposes), this means placing a xs:type="" attribute against the element. This is automatically done for you by the generated classes. Generated Code The element Address is a base element to CAN_Address and GBR_Address, and Address can be created as an element in its own right. This means that where ever Address can be used CAN_Address and GBR_Address can be used in its place. In order to implement this in the generated code, an abstract base class IAddress is introduced. All of the classes generated from Address, CAN_Address and GBR_Address implement this IAddress interface. Sample Description The sample demonstrates the use of the derived type Can_Address. Note the type specified in Person is 'Address' however any element deriving from it may used in its place. |
Sample XML File
Sample3.xml |
<?xml version="1.0" encoding="UTF-8"?> <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\DerivedByExtension.xsd" > <Age>32</Age> <HomeAddress xsi:type="CAN_Address"> <Name>Trevelyn</Name> <Street>8185 Great White North Bay</Street> <City>Thunder Bay</City> <Province>Ontario</Province> <PostalCode>M1A 3X9</PostalCode> </HomeAddress> </Person> |
Read Sample | |
SampleRead SamplePath + "DerivedByExtension\Samples\Sample3.xml" ' Create Name object Dim per As New DerivedBnsionLib.Person ' Load data into the object from a file per.FromXmlFile FilePath ' Now we can look at the data Trace "Age = " &; per.Age Trace "Address" Trace " Name = " &; per.HomeAddress.Name_ Trace " Street = " &; per.HomeAddress.Street Trace " City = " &; per.HomeAddress.City If TypeName(per.HomeAddress) = "DerivedBnsionLib.Address" Then ' The HomeAddress is an Address object, there is no more data to display ElseIf TypeName(per.HomeAddress) = "DerivedBnsionLib.CAN_Address" Then ' The HomeAddress is an CAN_Address object Dim oCan As DerivedBnsionLib.Can_Address Set oCan = per.HomeAddress Trace " City = " &; oCan.Province Trace " PostalCode = " &; oCan.PostalCode ElseIf TypeName(per.HomeAddress) = "DerivedBnsionLib.GBR_Address" Then ' The HomeAddress is an GBR_Address object Dim oGbr As DerivedBnsionLib.GBR_Address Set oGbr = per.HomeAddress Trace " County = " &; oGbr.County Trace " PostCode = " &; oGbr.PostCode Else ' The HomeAddress is an unknown type Trace "The Home address is an unknown type " &; TypeName(per.HomeAddress) End If
|
Write Sample | |
' Create Name object Dim per As New DerivedBnsionLib.Person Dim oCan As New DerivedBnsionLib.Can_Address ' populate the person object per.Age = 32 ' Create the right kind of address object Set oCan = New DerivedBnsionLib.Can_Address Set per.HomeAddress = oCan oCan.Name_ = "Trevelyn" oCan.Street = "8185 Great White North Bay" oCan.City = "Thunder Bay" oCan.Province = "Ontario" oCan.PostalCode = "M1A 3X9" ' Now we can look at the XML from this object Trace per.ToXml(True, XmlFormatting_Indented, XmlEncoding_UTF8)
|
DerivedByExtension.xsd |
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="Address"> <xs:sequence> <xs:element name="Name" type="xs:string"/> <xs:element name="Street" type="xs:string"/> <xs:element name="City" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="CAN_Address"> <xs:complexContent> <xs:extension base="Address"> <xs:sequence> <xs:element name="Province" type="xs:string"/> <xs:element name="PostalCode" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="GBR_Address"> <xs:complexContent> <xs:extension base="Address"> <xs:sequence> <xs:element name="County" type="xs:string"/> <xs:element name="PostCode" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="Person"> <xs:complexType> <xs:sequence> <xs:element name="Age" type="xs:unsignedByte"/> <xs:element name="HomeAddress" type="Address"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
Schema Diagrams |
|
Address.cls |
VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "Address" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit '********************************************************************************************** '* Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. '* See www.liquid-technologies.com for product details. '* '* Please see products End User License Agreement for distribution permissions. '* '* WARNING: THIS FILE IS GENERATED '* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten '* '* Generation : by Liquid XML Data Binder 19.0.14.11049 '* Using Schema: DerivedByExtension.xsd '********************************************************************************************** Private m_ElementName As String Private mvarName As String Private mvarStreet As String Private mvarCity As String ' ##HAND_CODED_BLOCK_START ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Variable Declarations... ' ##HAND_CODED_BLOCK_END ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Implements LtXmlComLib20.XmlObjectBase Implements LtXmlComLib20.XmlGeneratedClass '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''' Properties ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Get ElementName() As String ElementName = m_elementName End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get Name_ As String Name_ = mvarName End Property Public Property Let Name_(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarName = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get Street As String Street = mvarStreet End Property Public Property Let Street(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarStreet = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get City As String City = mvarCity End Property Public Property Let City(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarCity = value End Property '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''' Standard Methods ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub ToXmlFile(ByVal FileName As String, Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_CRLF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.ToXmlFile Me, FileName, includeDocHeader, formatting, encoding, EOL, context End Sub Public Function ToXml(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As String RegisterProduct ToXml = LtXmlComLib20.XmlObjectBaseHelper.ToXml(Me, includeDocHeader, formatting, EOL, context) End Function Public Function ToXmlStream(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As Variant RegisterProduct ToXmlStream = LtXmlComLib20.XmlObjectBaseHelper.ToXmlStream(Me, includeDocHeader, formatting, encoding, EOL, context) End Function Public Sub FromXml(ByVal xmlIn As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXml Me, xmlIn, context End Sub Public Sub FromXmlFile(ByVal FileName As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXmlFile Me, FileName, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''' Private Methods '''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Constructor for Address ' Remarks: ' The class is created with all the mandatory fields populated with the ' default data. ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd Private Sub Class_Initialize() m_elementName = "Address" XmlGeneratedClass_Init End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''' Implementation of XmlObjectBase ''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub XmlObjectBase_PrivateSetElementName(ByVal vNewValue As String) m_ElementName = vNewValue End Sub Private Property Get XmlObjectBase_ElementName() As String XmlObjectBase_ElementName = m_ElementName End Property Private Property Get XmlObjectBase_TargetNamespace() As String XmlObjectBase_TargetNamespace = "" End Property Private Function XmlObjectBase_IsSuitableSubstitution(ByVal InterfaceName As String) As Boolean XmlObjectBase_IsSuitableSubstitution = false if InterfaceName = "Address" _ or InterfaceName = "IAddress" _ then XmlObjectBase_IsSuitableSubstitution = true End Function Private Property Get XmlObjectBase_Namespace() As String XmlObjectBase_Namespace = "" End Property Private Function XmlObjectBase_FromXmlInt(ByVal XMLParent As MSXML2.IXMLDOMElement, ByVal XMLChild As MSXML2.IXMLDOMElement, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) As MSXML2.IXMLDOMElement Set XmlObjectBase_FromXmlInt = XmlGeneratedClassHelper.FromXml(Me, XMLParent, XMLChild, context, isOptionalChoice) End Function Private Sub XmlObjectBase_ToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal bRegisterNamespaces As Boolean, ByVal NamespaceUri As String, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) XmlGeneratedClassHelper.ToXml Me, xmlOut, bRegisterNamespaces, NamespaceUri, context, isOptionalChoice End Sub Private Sub XmlObjectBase_AttributesToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal context As LtXmlComLib20.XmlSerializationContext) XmlGeneratedClassHelper.AttributesToXml Me, xmlOut, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''' Implementation of XmlGeneratedClass ''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Initializes the class ' Remarks: ' The Creates all the mandatory fields (populated with the default data) ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd. Private Sub XmlGeneratedClass_Init() mvarName = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarStreet = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarCity = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) ' Force Init ClassInfo Dim classInfo As LtXmlComLib20.ClassInfo Set classInfo = XmlGeneratedClass_ClassInfo ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Init Settings... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub Private Property Get XmlGeneratedClass_ClassInfo() As LtXmlComLib20.ClassInfo If g_ClsDataAddress Is Nothing Then Set g_ClsDataAddress = New LtXmlComLib20.ClassInfo g_ClsDataAddress.GroupType = LtXmlComLib20.XmlGroupType.Sequence g_ClsDataAddress.ElementType = LtXmlComLib20.XmlElementType.Element g_ClsDataAddress.ElementName = "Address" g_ClsDataAddress.ElementNamespaceURI = "" g_ClsDataAddress.FromXmlFailIfAttributeUnknown = true g_ClsDataAddress.IsClassDerived = true g_ClsDataAddress.PrimitiveDataType = LtXmlComLib20.XmlDataType.type_none g_ClsDataAddress.PrimitiveFormatOverride = "" g_ClsDataAddress.OutputPrimitiveClassAsTextProperty = False Set g_ClsDataAddress.ClassFactory = General.CF g_ClsDataAddress.AddElmSeqPrimMnd "Name", "", "Name_", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataAddress.AddElmSeqPrimMnd "Street", "", "Street", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataAddress.AddElmSeqPrimMnd "City", "", "City", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 End If Set XmlGeneratedClass_ClassInfo = g_ClsDataAddress End Property ' ##HAND_CODED_BLOCK_START ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods/Properties Here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS |
CAN_Address.cls |
VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "CAN_Address" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit '********************************************************************************************** '* Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. '* See www.liquid-technologies.com for product details. '* '* Please see products End User License Agreement for distribution permissions. '* '* WARNING: THIS FILE IS GENERATED '* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten '* '* Generation : by Liquid XML Data Binder 19.0.14.11049 '* Using Schema: DerivedByExtension.xsd '********************************************************************************************** Private m_ElementName As String Private mvarName As String Private mvarStreet As String Private mvarCity As String Private mvarProvince As String Private mvarPostalCode As String ' ##HAND_CODED_BLOCK_START ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Variable Declarations... ' ##HAND_CODED_BLOCK_END ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Implements LtXmlComLib20.XmlObjectBase Implements LtXmlComLib20.XmlGeneratedClass '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''' Properties ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Get ElementName() As String ElementName = m_elementName End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get Name_ As String Name_ = mvarName End Property Public Property Let Name_(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarName = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get Street As String Street = mvarStreet End Property Public Property Let Street(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarStreet = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get City As String City = mvarCity End Property Public Property Let City(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarCity = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get Province As String Province = mvarProvince End Property Public Property Let Province(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarProvince = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get PostalCode As String PostalCode = mvarPostalCode End Property Public Property Let PostalCode(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarPostalCode = value End Property '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''' Standard Methods ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub ToXmlFile(ByVal FileName As String, Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_CRLF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.ToXmlFile Me, FileName, includeDocHeader, formatting, encoding, EOL, context End Sub Public Function ToXml(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As String RegisterProduct ToXml = LtXmlComLib20.XmlObjectBaseHelper.ToXml(Me, includeDocHeader, formatting, EOL, context) End Function Public Function ToXmlStream(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As Variant RegisterProduct ToXmlStream = LtXmlComLib20.XmlObjectBaseHelper.ToXmlStream(Me, includeDocHeader, formatting, encoding, EOL, context) End Function Public Sub FromXml(ByVal xmlIn As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXml Me, xmlIn, context End Sub Public Sub FromXmlFile(ByVal FileName As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXmlFile Me, FileName, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''' Private Methods '''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Constructor for CAN_Address ' Remarks: ' The class is created with all the mandatory fields populated with the ' default data. ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd Private Sub Class_Initialize() m_elementName = "CAN_Address" XmlGeneratedClass_Init End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''' Implementation of XmlObjectBase ''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub XmlObjectBase_PrivateSetElementName(ByVal vNewValue As String) m_ElementName = vNewValue End Sub Private Property Get XmlObjectBase_ElementName() As String XmlObjectBase_ElementName = m_ElementName End Property Private Property Get XmlObjectBase_TargetNamespace() As String XmlObjectBase_TargetNamespace = "" End Property Private Function XmlObjectBase_IsSuitableSubstitution(ByVal InterfaceName As String) As Boolean XmlObjectBase_IsSuitableSubstitution = false if InterfaceName = "CAN_Address" _ or InterfaceName = "IAddress" _ then XmlObjectBase_IsSuitableSubstitution = true End Function Private Property Get XmlObjectBase_Namespace() As String XmlObjectBase_Namespace = "" End Property Private Function XmlObjectBase_FromXmlInt(ByVal XMLParent As MSXML2.IXMLDOMElement, ByVal XMLChild As MSXML2.IXMLDOMElement, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) As MSXML2.IXMLDOMElement Set XmlObjectBase_FromXmlInt = XmlGeneratedClassHelper.FromXml(Me, XMLParent, XMLChild, context, isOptionalChoice) End Function Private Sub XmlObjectBase_ToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal bRegisterNamespaces As Boolean, ByVal NamespaceUri As String, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) XmlGeneratedClassHelper.ToXml Me, xmlOut, bRegisterNamespaces, NamespaceUri, context, isOptionalChoice End Sub Private Sub XmlObjectBase_AttributesToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal context As LtXmlComLib20.XmlSerializationContext) XmlGeneratedClassHelper.AttributesToXml Me, xmlOut, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''' Implementation of XmlGeneratedClass ''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Initializes the class ' Remarks: ' The Creates all the mandatory fields (populated with the default data) ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd. Private Sub XmlGeneratedClass_Init() mvarName = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarStreet = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarCity = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarProvince = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarPostalCode = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) ' Force Init ClassInfo Dim classInfo As LtXmlComLib20.ClassInfo Set classInfo = XmlGeneratedClass_ClassInfo ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Init Settings... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub Private Property Get XmlGeneratedClass_ClassInfo() As LtXmlComLib20.ClassInfo If g_ClsDataCAN_Address Is Nothing Then Set g_ClsDataCAN_Address = New LtXmlComLib20.ClassInfo g_ClsDataCAN_Address.GroupType = LtXmlComLib20.XmlGroupType.Sequence g_ClsDataCAN_Address.ElementType = LtXmlComLib20.XmlElementType.Element g_ClsDataCAN_Address.ElementName = "CAN_Address" g_ClsDataCAN_Address.ElementNamespaceURI = "" g_ClsDataCAN_Address.FromXmlFailIfAttributeUnknown = true g_ClsDataCAN_Address.IsClassDerived = true g_ClsDataCAN_Address.PrimitiveDataType = LtXmlComLib20.XmlDataType.type_none g_ClsDataCAN_Address.PrimitiveFormatOverride = "" g_ClsDataCAN_Address.OutputPrimitiveClassAsTextProperty = False Set g_ClsDataCAN_Address.ClassFactory = General.CF g_ClsDataCAN_Address.AddElmSeqPrimMnd "Name", "", "Name_", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataCAN_Address.AddElmSeqPrimMnd "Street", "", "Street", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataCAN_Address.AddElmSeqPrimMnd "City", "", "City", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataCAN_Address.AddElmSeqPrimMnd "Province", "", "Province", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataCAN_Address.AddElmSeqPrimMnd "PostalCode", "", "PostalCode", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 End If Set XmlGeneratedClass_ClassInfo = g_ClsDataCAN_Address End Property ' ##HAND_CODED_BLOCK_START ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods/Properties Here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS |
GBR_Address.cls |
VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "GBR_Address" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit '********************************************************************************************** '* Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. '* See www.liquid-technologies.com for product details. '* '* Please see products End User License Agreement for distribution permissions. '* '* WARNING: THIS FILE IS GENERATED '* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten '* '* Generation : by Liquid XML Data Binder 19.0.14.11049 '* Using Schema: DerivedByExtension.xsd '********************************************************************************************** Private m_ElementName As String Private mvarName As String Private mvarStreet As String Private mvarCity As String Private mvarCounty As String Private mvarPostCode As String ' ##HAND_CODED_BLOCK_START ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Variable Declarations... ' ##HAND_CODED_BLOCK_END ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Implements LtXmlComLib20.XmlObjectBase Implements LtXmlComLib20.XmlGeneratedClass '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''' Properties ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Get ElementName() As String ElementName = m_elementName End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get Name_ As String Name_ = mvarName End Property Public Property Let Name_(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarName = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get Street As String Street = mvarStreet End Property Public Property Let Street(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarStreet = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get City As String City = mvarCity End Property Public Property Let City(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarCity = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get County As String County = mvarCounty End Property Public Property Let County(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarCounty = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to . Public Property Get PostCode As String PostCode = mvarPostCode End Property Public Property Let PostCode(ByVal value As String) ' Apply whitespace rules appropriately value = LtXmlComLib20.WhitespaceUtils.PreserveWhitespace(value) mvarPostCode = value End Property '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''' Standard Methods ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub ToXmlFile(ByVal FileName As String, Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_CRLF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.ToXmlFile Me, FileName, includeDocHeader, formatting, encoding, EOL, context End Sub Public Function ToXml(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As String RegisterProduct ToXml = LtXmlComLib20.XmlObjectBaseHelper.ToXml(Me, includeDocHeader, formatting, EOL, context) End Function Public Function ToXmlStream(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As Variant RegisterProduct ToXmlStream = LtXmlComLib20.XmlObjectBaseHelper.ToXmlStream(Me, includeDocHeader, formatting, encoding, EOL, context) End Function Public Sub FromXml(ByVal xmlIn As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXml Me, xmlIn, context End Sub Public Sub FromXmlFile(ByVal FileName As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXmlFile Me, FileName, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''' Private Methods '''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Constructor for GBR_Address ' Remarks: ' The class is created with all the mandatory fields populated with the ' default data. ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd Private Sub Class_Initialize() m_elementName = "GBR_Address" XmlGeneratedClass_Init End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''' Implementation of XmlObjectBase ''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub XmlObjectBase_PrivateSetElementName(ByVal vNewValue As String) m_ElementName = vNewValue End Sub Private Property Get XmlObjectBase_ElementName() As String XmlObjectBase_ElementName = m_ElementName End Property Private Property Get XmlObjectBase_TargetNamespace() As String XmlObjectBase_TargetNamespace = "" End Property Private Function XmlObjectBase_IsSuitableSubstitution(ByVal InterfaceName As String) As Boolean XmlObjectBase_IsSuitableSubstitution = false if InterfaceName = "GBR_Address" _ or InterfaceName = "IAddress" _ then XmlObjectBase_IsSuitableSubstitution = true End Function Private Property Get XmlObjectBase_Namespace() As String XmlObjectBase_Namespace = "" End Property Private Function XmlObjectBase_FromXmlInt(ByVal XMLParent As MSXML2.IXMLDOMElement, ByVal XMLChild As MSXML2.IXMLDOMElement, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) As MSXML2.IXMLDOMElement Set XmlObjectBase_FromXmlInt = XmlGeneratedClassHelper.FromXml(Me, XMLParent, XMLChild, context, isOptionalChoice) End Function Private Sub XmlObjectBase_ToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal bRegisterNamespaces As Boolean, ByVal NamespaceUri As String, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) XmlGeneratedClassHelper.ToXml Me, xmlOut, bRegisterNamespaces, NamespaceUri, context, isOptionalChoice End Sub Private Sub XmlObjectBase_AttributesToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal context As LtXmlComLib20.XmlSerializationContext) XmlGeneratedClassHelper.AttributesToXml Me, xmlOut, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''' Implementation of XmlGeneratedClass ''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Initializes the class ' Remarks: ' The Creates all the mandatory fields (populated with the default data) ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd. Private Sub XmlGeneratedClass_Init() mvarName = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarStreet = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarCity = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarCounty = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) mvarPostCode = LtXmlComLib20.Conversions.stringFromString("", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve) ' Force Init ClassInfo Dim classInfo As LtXmlComLib20.ClassInfo Set classInfo = XmlGeneratedClass_ClassInfo ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Init Settings... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub Private Property Get XmlGeneratedClass_ClassInfo() As LtXmlComLib20.ClassInfo If g_ClsDataGBR_Address Is Nothing Then Set g_ClsDataGBR_Address = New LtXmlComLib20.ClassInfo g_ClsDataGBR_Address.GroupType = LtXmlComLib20.XmlGroupType.Sequence g_ClsDataGBR_Address.ElementType = LtXmlComLib20.XmlElementType.Element g_ClsDataGBR_Address.ElementName = "GBR_Address" g_ClsDataGBR_Address.ElementNamespaceURI = "" g_ClsDataGBR_Address.FromXmlFailIfAttributeUnknown = true g_ClsDataGBR_Address.IsClassDerived = true g_ClsDataGBR_Address.PrimitiveDataType = LtXmlComLib20.XmlDataType.type_none g_ClsDataGBR_Address.PrimitiveFormatOverride = "" g_ClsDataGBR_Address.OutputPrimitiveClassAsTextProperty = False Set g_ClsDataGBR_Address.ClassFactory = General.CF g_ClsDataGBR_Address.AddElmSeqPrimMnd "Name", "", "Name_", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataGBR_Address.AddElmSeqPrimMnd "Street", "", "Street", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataGBR_Address.AddElmSeqPrimMnd "City", "", "City", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataGBR_Address.AddElmSeqPrimMnd "County", "", "County", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 g_ClsDataGBR_Address.AddElmSeqPrimMnd "PostCode", "", "PostCode", XmlDataType.type_string, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1 End If Set XmlGeneratedClass_ClassInfo = g_ClsDataGBR_Address End Property ' ##HAND_CODED_BLOCK_START ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods/Properties Here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS |
Person.cls |
VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "Person" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit '********************************************************************************************** '* Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. '* See www.liquid-technologies.com for product details. '* '* Please see products End User License Agreement for distribution permissions. '* '* WARNING: THIS FILE IS GENERATED '* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten '* '* Generation : by Liquid XML Data Binder 19.0.14.11049 '* Using Schema: DerivedByExtension.xsd '********************************************************************************************** Private m_ElementName As String Private mvarAge As Byte Private mvarHomeAddress As Object ' LtXmlComLib20.XmlObjectBase ' ##HAND_CODED_BLOCK_START ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Variable Declarations... ' ##HAND_CODED_BLOCK_END ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Implements LtXmlComLib20.XmlObjectBase Implements LtXmlComLib20.XmlGeneratedClass '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''' Properties ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Get ElementName() As String ElementName = m_elementName End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' It is defaulted to 0. Public Property Get Age As Byte Age = mvarAge End Property Public Property Let Age(ByVal value As Byte) mvarAge = value End Property ' Summary: ' Represents a mandatory Element in the XML document ' ' Remarks: ' ' This property is represented as an Element in the XML. ' It is mandatory and therefore must be populated within the XML. ' If this property is set, then the object will be COPIED. If the property is set to null an exception is raised. Public Property Get HomeAddress As object ' LtXmlComLib20.XmlObjectBase Set HomeAddress = mvarHomeAddress End Property Public Property Set HomeAddress (byVal value As object) ' LtXmlComLib20.XmlObjectBase LtXmlComLib20.XmlObjectBaseHelper.Throw_IfPropertyIsNull value, "HomeAddress" if not value is nothing then ' The object being set needs to take the element name from the class (the type="" attribute will then be set in the XML) CastToXmlObjectBase(value).PrivateSetElementName "HomeAddress" end if LtXmlComLib20.XmlObjectBaseHelper.Throw_IfInvalidSubstitution value, "IAddress" Set mvarHomeAddress = value End Property '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''' Standard Methods ''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub ToXmlFile(ByVal FileName As String, Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_CRLF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.ToXmlFile Me, FileName, includeDocHeader, formatting, encoding, EOL, context End Sub Public Function ToXml(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As String RegisterProduct ToXml = LtXmlComLib20.XmlObjectBaseHelper.ToXml(Me, includeDocHeader, formatting, EOL, context) End Function Public Function ToXmlStream(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib20.XmlFormatting = LtXmlComLib20.XmlFormatting_Indented, Optional encoding As LtXmlComLib20.XmlEncoding = LtXmlComLib20.XmlEncoding_UTF8, Optional EOL As LtXmlComLib20.EOLType = LtXmlComLib20.EOLType.EOLType_LF, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) As Variant RegisterProduct ToXmlStream = LtXmlComLib20.XmlObjectBaseHelper.ToXmlStream(Me, includeDocHeader, formatting, encoding, EOL, context) End Function Public Sub FromXml(ByVal xmlIn As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXml Me, xmlIn, context End Sub Public Sub FromXmlFile(ByVal FileName As String, Optional context As LtXmlComLib20.XmlSerializationContext = Nothing) RegisterProduct LtXmlComLib20.XmlObjectBaseHelper.FromXmlFile Me, FileName, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''' Private Methods '''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Constructor for Person ' Remarks: ' The class is created with all the mandatory fields populated with the ' default data. ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd Private Sub Class_Initialize() m_elementName = "Person" XmlGeneratedClass_Init End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''' Implementation of XmlObjectBase ''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub XmlObjectBase_PrivateSetElementName(ByVal vNewValue As String) m_ElementName = vNewValue End Sub Private Property Get XmlObjectBase_ElementName() As String XmlObjectBase_ElementName = m_ElementName End Property Private Property Get XmlObjectBase_TargetNamespace() As String XmlObjectBase_TargetNamespace = "" End Property Private Function XmlObjectBase_IsSuitableSubstitution(ByVal InterfaceName As String) As Boolean XmlObjectBase_IsSuitableSubstitution = false if InterfaceName = "Person" _ then XmlObjectBase_IsSuitableSubstitution = true End Function Private Property Get XmlObjectBase_Namespace() As String XmlObjectBase_Namespace = "" End Property Private Function XmlObjectBase_FromXmlInt(ByVal XMLParent As MSXML2.IXMLDOMElement, ByVal XMLChild As MSXML2.IXMLDOMElement, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) As MSXML2.IXMLDOMElement Set XmlObjectBase_FromXmlInt = XmlGeneratedClassHelper.FromXml(Me, XMLParent, XMLChild, context, isOptionalChoice) End Function Private Sub XmlObjectBase_ToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal bRegisterNamespaces As Boolean, ByVal NamespaceUri As String, ByVal context As LtXmlComLib20.XmlSerializationContext, ByVal isOptionalChoice As Boolean) XmlGeneratedClassHelper.ToXml Me, xmlOut, bRegisterNamespaces, NamespaceUri, context, isOptionalChoice End Sub Private Sub XmlObjectBase_AttributesToXmlInt(ByVal xmlOut As LtXmlComLib20.XmlTextWriter, ByVal context As LtXmlComLib20.XmlSerializationContext) XmlGeneratedClassHelper.AttributesToXml Me, xmlOut, context End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''' Implementation of XmlGeneratedClass ''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Summary: ' Initializes the class ' Remarks: ' The Creates all the mandatory fields (populated with the default data) ' All Collection object are created. ' However any 1-n relationships (these are represented as collections) are ' empty. To comply with the schema these must be populated before the xml ' obtained from ToXml is valid against the schema DerivedByExtension.xsd. Private Sub XmlGeneratedClass_Init() mvarAge = LtXmlComLib20.Conversions.ui1FromString("0", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Collapse) Set mvarHomeAddress = Nothing ' Force Init ClassInfo Dim classInfo As LtXmlComLib20.ClassInfo Set classInfo = XmlGeneratedClass_ClassInfo ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Init Settings... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub Private Property Get XmlGeneratedClass_ClassInfo() As LtXmlComLib20.ClassInfo If g_ClsDataPerson Is Nothing Then Set g_ClsDataPerson = New LtXmlComLib20.ClassInfo g_ClsDataPerson.GroupType = LtXmlComLib20.XmlGroupType.Sequence g_ClsDataPerson.ElementType = LtXmlComLib20.XmlElementType.Element g_ClsDataPerson.ElementName = "Person" g_ClsDataPerson.ElementNamespaceURI = "" g_ClsDataPerson.FromXmlFailIfAttributeUnknown = true g_ClsDataPerson.IsClassDerived = false g_ClsDataPerson.PrimitiveDataType = LtXmlComLib20.XmlDataType.type_none g_ClsDataPerson.PrimitiveFormatOverride = "" g_ClsDataPerson.OutputPrimitiveClassAsTextProperty = False Set g_ClsDataPerson.ClassFactory = General.CF g_ClsDataPerson.AddElmSeqPrimMnd "Age", "", "Age", XmlDataType.type_ui1, "", LtXmlComLib20.WhitespaceRule.WhitespaceRule_Collapse, "", -1, -1, "", "", "", "", -1 g_ClsDataPerson.AddElmSeqAbsClsMnd "HomeAddress", "", "HomeAddress", LtXmlComLib20.XmlElementType.Element, "IAddressCreateObject" End If Set XmlGeneratedClass_ClassInfo = g_ClsDataPerson End Property ' ##HAND_CODED_BLOCK_START ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods/Properties Here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS |
Main Menu | Samples List |