VB.Net 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 base Address type. Note other elements derived from Address may be used in its place (See Samples 2 and 3). |
Sample XML File
Sample1.xml |
<?xml version="1.0" encoding="UTF-8"?> <Person> <Age>32</Age> <HomeAddress> <Name>Joe Bloggs</Name> <Street>1045 Winter Av</Street> <City>New York</City> </HomeAddress> </Person> |
Read Sample | |
SampleRead(Module1.SamplePath + "DerivedByExtension\Samples\Sample1.xml") ' Create Name object Dim per As DerivedByExtensionLib.Person = New DerivedByExtensionLib.Person() ' Load data into the object from a file per.FromXmlFile(FilePath) ' Now we can look at the data Console.WriteLine("Age = {0}", per.Age) Console.WriteLine("Address") Console.WriteLine(" Name = {0}", per.HomeAddress.Name) Console.WriteLine(" Street = {0}", per.HomeAddress.Street) Console.WriteLine(" City = {0}", per.HomeAddress.City) If (per.HomeAddress.GetType() Is GetType(DerivedByExtensionLib.Address)) Then ' The HomeAddress is an Address object, there is no more data to display ElseIf (per.HomeAddress.GetType() Is GetType(DerivedByExtensionLib.CAN_Address)) Then ' The HomeAddress is an CAN_Address object Dim perHomeAddress As DerivedByExtensionLib.CAN_Address = per.HomeAddress Console.WriteLine(" PostalCode = {0}", perHomeAddress.PostalCode) ElseIf (per.HomeAddress.GetType() Is GetType(DerivedByExtensionLib.GBR_Address)) Then ' The HomeAddress is an GBR_Address object Dim perGBR_Address As DerivedByExtensionLib.GBR_Address = per.HomeAddress Console.WriteLine(" County = {0}", perGBR_Address.County) Console.WriteLine(" PostCode = {0}", perGBR_Address.PostCode) Else ' The HomeAddress is an unknown type Console.WriteLine("The Home address is an unknown type {0}", per.HomeAddress.GetType().FullName) End If
|
Write Sample | |
' Create Name object Dim per As DerivedByExtensionLib.Person = New DerivedByExtensionLib.Person() ' populate the person object per.Age = 32 ' Create the right kind of address object per.HomeAddress = New DerivedByExtensionLib.Address() per.HomeAddress.Name = "Joe Bloggs" per.HomeAddress.Street = "1045 Winter Av" per.HomeAddress.City = "New York" ' Now we can look at the XML from this object Console.WriteLine(per.ToXml(True, System.Xml.Formatting.Indented, LiquidTechnologies.Runtime.EOLType.CRLF))
|
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.vb |
Option Explicit On Option Strict On Imports System Imports System.Xml '********************************************************************************************** '* 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 '********************************************************************************************** Namespace DerivedByExtensionLib ''' <summary> ''' This class represents the ComplexType Address ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "Address", "", true, true, false)> _ Public Partial Class Address Inherits DerivedByExtensionLib.XmlCommonBase Implements DerivedByExtensionLib.IAddress #Region "Constructors" ''' <summary> ''' Constructor for Address ''' </summary> ''' <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 ''' </remarks> Public Sub New() _elementName = "Address" Init() End Sub Public Sub New(ByVal elementName As String) _elementName = elementName Init() End Sub #End Region #Region "Initialization methods for the class" ''' <summary> ''' Initializes the class ''' </summary> ''' <remarks> ''' This 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. ''' </remarks> Protected Overrides Sub Init() DerivedByExtensionLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _Name = "" _Street = "" _City = "" ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional initialization code here... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub #End Region #Region "ICloneable Interface" ''' <summary> ''' Allows the class to be copied ''' </summary> ''' <remarks> ''' Performs a 'deep copy' of all the data in the class (and its children) ''' </remarks> Public Overrides Function Clone() As Object Dim newObject As New DerivedByExtensionLib.Address(_elementName) Dim o As Object newObject._Name = _Name newObject._Street = _Street newObject._City = _City o = Nothing ' ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional clone code here... ' ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Return newObject End Function #End Region #Region "Member variables" Protected Overrides Readonly Property TargetNamespace() As String Get Return "" End Get End Property #Region "Attribute - Name" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Name", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Name() As String Implements DerivedByExtensionLib.IAddress.Name Get Return _Name End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Name = value End Set End Property Protected _Name As String #End Region #Region "Attribute - Street" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Street", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Street() As String Implements DerivedByExtensionLib.IAddress.Street Get Return _Street End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Street = value End Set End Property Protected _Street As String #End Region #Region "Attribute - City" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("City", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property City() As String Implements DerivedByExtensionLib.IAddress.City Get Return _City End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _City = value End Set End Property Protected _City As String #End Region #Region "Attribute - Namespace" Public Overrides Readonly Property [Namespace]() As String Get Return "" End Get End Property #End Region #Region "Attribute - GetBase" Public Overrides Function GetBase() As LiquidTechnologies.Runtime.XmlObjectBase Return Me End Function #End Region #End Region ' ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods and members here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Class End Namespace |
CAN_Address.vb |
Option Explicit On Option Strict On Imports System Imports System.Xml '********************************************************************************************** '* 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 '********************************************************************************************** Namespace DerivedByExtensionLib ''' <summary> ''' This class represents the ComplexType CAN_Address ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "CAN_Address", "", true, true, false)> _ Public Partial Class CAN_Address Inherits DerivedByExtensionLib.XmlCommonBase Implements DerivedByExtensionLib.IAddress #Region "Constructors" ''' <summary> ''' Constructor for CAN_Address ''' </summary> ''' <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 ''' </remarks> Public Sub New() _elementName = "CAN_Address" Init() End Sub Public Sub New(ByVal elementName As String) _elementName = elementName Init() End Sub #End Region #Region "Initialization methods for the class" ''' <summary> ''' Initializes the class ''' </summary> ''' <remarks> ''' This 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. ''' </remarks> Protected Overrides Sub Init() DerivedByExtensionLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _Name = "" _Street = "" _City = "" _Province = "" _PostalCode = "" ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional initialization code here... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub #End Region #Region "ICloneable Interface" ''' <summary> ''' Allows the class to be copied ''' </summary> ''' <remarks> ''' Performs a 'deep copy' of all the data in the class (and its children) ''' </remarks> Public Overrides Function Clone() As Object Dim newObject As New DerivedByExtensionLib.CAN_Address(_elementName) Dim o As Object newObject._Name = _Name newObject._Street = _Street newObject._City = _City newObject._Province = _Province newObject._PostalCode = _PostalCode o = Nothing ' ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional clone code here... ' ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Return newObject End Function #End Region #Region "Member variables" Protected Overrides Readonly Property TargetNamespace() As String Get Return "" End Get End Property #Region "Attribute - Name" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Name", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Name() As String Implements DerivedByExtensionLib.IAddress.Name Get Return _Name End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Name = value End Set End Property Protected _Name As String #End Region #Region "Attribute - Street" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Street", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Street() As String Implements DerivedByExtensionLib.IAddress.Street Get Return _Street End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Street = value End Set End Property Protected _Street As String #End Region #Region "Attribute - City" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("City", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property City() As String Implements DerivedByExtensionLib.IAddress.City Get Return _City End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _City = value End Set End Property Protected _City As String #End Region #Region "Attribute - Province" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Province", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Province() As String Get Return _Province End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Province = value End Set End Property Protected _Province As String #End Region #Region "Attribute - PostalCode" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("PostalCode", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property PostalCode() As String Get Return _PostalCode End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _PostalCode = value End Set End Property Protected _PostalCode As String #End Region #Region "Attribute - Namespace" Public Overrides Readonly Property [Namespace]() As String Get Return "" End Get End Property #End Region #Region "Attribute - GetBase" Public Overrides Function GetBase() As LiquidTechnologies.Runtime.XmlObjectBase Return Me End Function #End Region #End Region ' ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods and members here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Class End Namespace |
GBR_Address.vb |
Option Explicit On Option Strict On Imports System Imports System.Xml '********************************************************************************************** '* 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 '********************************************************************************************** Namespace DerivedByExtensionLib ''' <summary> ''' This class represents the ComplexType GBR_Address ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "GBR_Address", "", true, true, false)> _ Public Partial Class GBR_Address Inherits DerivedByExtensionLib.XmlCommonBase Implements DerivedByExtensionLib.IAddress #Region "Constructors" ''' <summary> ''' Constructor for GBR_Address ''' </summary> ''' <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 ''' </remarks> Public Sub New() _elementName = "GBR_Address" Init() End Sub Public Sub New(ByVal elementName As String) _elementName = elementName Init() End Sub #End Region #Region "Initialization methods for the class" ''' <summary> ''' Initializes the class ''' </summary> ''' <remarks> ''' This 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. ''' </remarks> Protected Overrides Sub Init() DerivedByExtensionLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _Name = "" _Street = "" _City = "" _County = "" _PostCode = "" ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional initialization code here... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub #End Region #Region "ICloneable Interface" ''' <summary> ''' Allows the class to be copied ''' </summary> ''' <remarks> ''' Performs a 'deep copy' of all the data in the class (and its children) ''' </remarks> Public Overrides Function Clone() As Object Dim newObject As New DerivedByExtensionLib.GBR_Address(_elementName) Dim o As Object newObject._Name = _Name newObject._Street = _Street newObject._City = _City newObject._County = _County newObject._PostCode = _PostCode o = Nothing ' ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional clone code here... ' ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Return newObject End Function #End Region #Region "Member variables" Protected Overrides Readonly Property TargetNamespace() As String Get Return "" End Get End Property #Region "Attribute - Name" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Name", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Name() As String Implements DerivedByExtensionLib.IAddress.Name Get Return _Name End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Name = value End Set End Property Protected _Name As String #End Region #Region "Attribute - Street" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Street", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Street() As String Implements DerivedByExtensionLib.IAddress.Street Get Return _Street End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Street = value End Set End Property Protected _Street As String #End Region #Region "Attribute - City" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("City", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property City() As String Implements DerivedByExtensionLib.IAddress.City Get Return _City End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _City = value End Set End Property Protected _City As String #End Region #Region "Attribute - County" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("County", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property County() As String Get Return _County End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _County = value End Set End Property Protected _County As String #End Region #Region "Attribute - PostCode" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 "". ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("PostCode", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property PostCode() As String Get Return _PostCode End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _PostCode = value End Set End Property Protected _PostCode As String #End Region #Region "Attribute - Namespace" Public Overrides Readonly Property [Namespace]() As String Get Return "" End Get End Property #End Region #Region "Attribute - GetBase" Public Overrides Function GetBase() As LiquidTechnologies.Runtime.XmlObjectBase Return Me End Function #End Region #End Region ' ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods and members here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Class End Namespace |
IAddress.vb |
Option Explicit On Option Strict On Imports System Imports System.Xml ' ********************************************************************************************** ' * 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 ' ********************************************************************************************** Namespace DerivedByExtensionLib ''' <summary> ''' </summary> Public Interface IAddress Inherits LiquidTechnologies.Runtime.XmlObjectInterface #Region "Member variables" #Region "Attribute - Name" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> Property Name() As String #End Region #Region "Attribute - Street" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> Property Street() As String #End Region #Region "Attribute - City" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> Property City() As String #End Region #End Region ' ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods and members here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Interface End Namespace |
Person.vb |
Option Explicit On Option Strict On Imports System Imports System.Xml '********************************************************************************************** '* 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 '********************************************************************************************** Namespace DerivedByExtensionLib ''' <summary> ''' This class represents the Element Person ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "Person", "", true, false, false)> _ Public Partial Class Person Inherits DerivedByExtensionLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for Person ''' </summary> ''' <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 ''' </remarks> Public Sub New() _elementName = "Person" Init() End Sub Public Sub New(ByVal elementName As String) _elementName = elementName Init() End Sub #End Region #Region "Initialization methods for the class" ''' <summary> ''' Initializes the class ''' </summary> ''' <remarks> ''' This 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. ''' </remarks> Protected Overrides Sub Init() DerivedByExtensionLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _Age = 0 _HomeAddress = Nothing ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional initialization code here... ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Sub #End Region #Region "ICloneable Interface" ''' <summary> ''' Allows the class to be copied ''' </summary> ''' <remarks> ''' Performs a 'deep copy' of all the data in the class (and its children) ''' </remarks> Public Overrides Function Clone() As Object Dim newObject As New DerivedByExtensionLib.Person(_elementName) Dim o As Object newObject._Age = _Age newObject._HomeAddress = Nothing If Not _HomeAddress Is Nothing Then newObject._HomeAddress = CType(_HomeAddress.Clone(), DerivedByExtensionLib.IAddress) End If o = Nothing ' ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional clone code here... ' ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS Return newObject End Function #End Region #Region "Member variables" Protected Overrides Readonly Property TargetNamespace() As String Get Return "" End Get End Property #Region "Attribute - Age" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Age", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui1, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Age() As Byte Get Return _Age End Get Set(ByVal value As Byte) _Age = value End Set End Property Protected _Age As Byte #End Region #Region "Attribute - HomeAddress" ''' <summary> ''' Represents a mandatory Element in the XML document ''' </summary> ''' <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 Nothing an exception is raised. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqAbsClsMnd("HomeAddress", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, GetType(DerivedByExtensionLib.ClassFactory), "IAddressCreateObject")> _ Public Property HomeAddress() As DerivedByExtensionLib.IAddress Get Return _HomeAddress End Get Set(ByVal value As DerivedByExtensionLib.IAddress) 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) SetElementName(value.GetBase(), "HomeAddress") End If _HomeAddress = value End Set End Property Protected _HomeAddress As DerivedByExtensionLib.IAddress #End Region #Region "Attribute - Namespace" Public Overrides Readonly Property [Namespace]() As String Get Return "" End Get End Property #End Region #Region "Attribute - GetBase" Public Overrides Function GetBase() As LiquidTechnologies.Runtime.XmlObjectBase Return Me End Function #End Region #End Region ' ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS ' Add Additional Methods and members here... ' ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS End Class End Namespace |
Main Menu | Samples List |