VB.Net Sample : Simple Hierarchy
Schema Summary This sample shows a number of elements within a Hierarchy. It includes local (anonymous) & global complex types. It also shows how collections are manipulated within sequences & choices. Schema Details This schema contains 2 globally defined elements AddressType, ItemType and Invoice. All of these objects can be used as the documentElement (root element) in a valid XML document. The Invoice object also contains a sequence, the sequence contains a number of child elements; InvoiceNo is a primitive DeliveryAddress is a element that conforms to the global element AddressType. BillingAddress is an optional (the corresponding property on the Invoice object may contain a null because of this) element that conforms to the global element AddressType. Item is a collection of elements conforming to the global element ItemType. Payment is a locally defined element, it in turn contains a choice of; an element 'VISA' or a collection of 'Vouchers' elements or an element 'Cash' which is untyped within the schema, and represented as a string within the generated code. Sample Description The sample builds on the previous sample, and demonstrates how to deal with a choice that contains a collection of elements. |
Sample XML File
Sample2.xml |
<?xml version="1.0" encoding="UTF-8"?> <Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\SimpleHierarchy.xsd"> <InvoiceNo>564</InvoiceNo> <DeliveryAddress> <Forename>Joe</Forename> <Surname>Bloggs</Surname> <AddresLine1>23 Summers lane</AddresLine1> <AddresLine2>Wintersville</AddresLine2> <AddresLine5>Stoke</AddresLine5> <PostCode>SK4 8LS</PostCode> </DeliveryAddress> <BillingAddress> <Forename>Jane</Forename> <Surname>Doe</Surname> <AddresLine1>Acme Account</AddresLine1> <AddresLine2>Acme House</AddresLine2> <AddresLine3>523 Hogarth Lane</AddresLine3> <AddresLine5>Collegeville</AddresLine5> <PostCode>CL5 4UT</PostCode> </BillingAddress> <Item> <StockCode>6896</StockCode> <Description>A4 Paper (white)</Description> <UnitCost>495</UnitCost> <Quantity>15</Quantity> </Item> <Item> <StockCode>5161</StockCode> <Description>Paper Clips (Large)</Description> <UnitCost>54</UnitCost> <Quantity>10</Quantity> </Item> <Payment> <Vouchers VoucherNo="546487951" VoucherValue="5000"/> <Vouchers VoucherNo="654646466" VoucherValue="500"/> <Vouchers VoucherNo="654649849" VoucherValue="2500"/> </Payment> </Invoice> |
Read Sample | |
Dim FilePath As String = Module1.SamplePath + "SimpleHierarchy\\Samples\\Sample2.xml" ' Create Invoice object Dim invoice As SimpleHierarchyLib.Invoice = New SimpleHierarchyLib.Invoice() ' Load data into the object from a file invoice.FromXmlFile(FilePath) ' Now we can look at the data Console.WriteLine("Invoice No = {0}", invoice.InvoiceNo) ' look at the billing address ' The billing address is optional, so we need to check it has been provided If (Not invoice.BillingAddress Is Nothing) Then Console.WriteLine("Billing Addresss") Console.WriteLine(" Forename = {0}", invoice.BillingAddress.Forename) Console.WriteLine(" Surname = {0}", invoice.BillingAddress.Surname) Console.WriteLine(" Address Line 1 = {0}", invoice.BillingAddress.AddresLine1) Console.WriteLine(" Address Line 2 = {0}", invoice.BillingAddress.AddresLine2) ' AddresLine3 & AddresLine4 are optional, so check they are valid before using them If (Not invoice.BillingAddress.AddresLine3 Is Nothing) Then Console.WriteLine(" Address Line 3 = {0}", invoice.BillingAddress.AddresLine3) End If If (Not invoice.BillingAddress.AddresLine4 Is Nothing) Then Console.WriteLine(" Address Line 4 = {0}", invoice.BillingAddress.AddresLine4) End If Console.WriteLine(" Address Line 5 = {0}", invoice.BillingAddress.AddresLine5) Console.WriteLine(" Postcode = {0}", invoice.BillingAddress.PostCode) End If ' look at the Shipping address Console.WriteLine("Billing Addresss") Console.WriteLine(" Forename = {0}", invoice.DeliveryAddress.Forename) Console.WriteLine(" Surname = {0}", invoice.DeliveryAddress.Surname) Console.WriteLine(" Address Line 1 = {0}", invoice.DeliveryAddress.AddresLine1) Console.WriteLine(" Address Line 2 = {0}", invoice.DeliveryAddress.AddresLine2) ' AddresLine3 & AddresLine4 are optional, so check they are valid before using them If (Not invoice.DeliveryAddress.AddresLine3 Is Nothing) Then Console.WriteLine(" Address Line 3 = {0}", invoice.DeliveryAddress.AddresLine3) End If If (Not invoice.DeliveryAddress.AddresLine4 Is Nothing) Then Console.WriteLine(" Address Line 4 = {0}", invoice.DeliveryAddress.AddresLine4) End If Console.WriteLine(" Address Line 5 = {0}", invoice.DeliveryAddress.AddresLine5) Console.WriteLine(" Postcode = {0}", invoice.DeliveryAddress.PostCode) ' look at all the items in the invoice Console.WriteLine("There are {0} items in the order", invoice.Item.Count) Dim itm As SimpleHierarchyLib.ItemType For Each itm In invoice.Item Console.WriteLine("Item") Console.WriteLine(" StockCode = {0}", itm.StockCode) Console.WriteLine(" Description = {0}", itm.Description) Console.WriteLine(" UnitCost = {0}", itm.UnitCost) Console.WriteLine(" Quantity = {0}", itm.Quantity) Next itm ' now look at the Payment method, this is a choice in the schema, ' so only one option is posible If (invoice.Payment.ChoiceSelectedElement = "Cash") Then Console.WriteLine("The invoice was paid in Cash") ElseIf (invoice.Payment.ChoiceSelectedElement = "VISA") Then Console.WriteLine("The invoice was paid with a VISA Card") Console.WriteLine(" Card Number = {0}", invoice.Payment.VISA.CardNo) Console.WriteLine(" Card Expiry = {0}", invoice.Payment.VISA.Expiry) ElseIf (invoice.Payment.ChoiceSelectedElement = "Vouchers") Then Console.WriteLine("The invoice was paid with Vouchers") Dim v As SimpleHierarchyLib.Vouchers For Each v In invoice.Payment.Vouchers Console.WriteLine("Voucher") Console.WriteLine(" Number = {0}", v.VoucherNo) Console.WriteLine(" Value = {0}", v.VoucherValue) Next v Else Console.WriteLine("Unknown selected element {0}", invoice.Payment.ChoiceSelectedElement) End If
|
Write Sample | |
' Create Invoice object Dim invoice As SimpleHierarchyLib.Invoice = New SimpleHierarchyLib.Invoice() ' Now we can look at the data invoice.InvoiceNo = 564 ' because the BillingAddress is optional, we need to populate ' this property before using it. invoice.BillingAddress = New SimpleHierarchyLib.AddressType() invoice.BillingAddress.Forename = "Joe" invoice.BillingAddress.Surname = "Bloggs" invoice.BillingAddress.AddresLine1 = "23 Summers lane" invoice.BillingAddress.AddresLine2 = "Wintersville" invoice.BillingAddress.AddresLine5 = "Stoke" invoice.BillingAddress.PostCode = "SK4 8LS" invoice.DeliveryAddress = New SimpleHierarchyLib.AddressType() invoice.DeliveryAddress.Forename = "Jane" invoice.DeliveryAddress.Surname = "Doe" invoice.DeliveryAddress.AddresLine1 = "Acme Account" invoice.DeliveryAddress.AddresLine2 = "Acme House" ' This is an optional field, setting it makes it appear in the output xml invoice.DeliveryAddress.AddresLine3 = "523 Hogarth Lane" invoice.DeliveryAddress.AddresLine5 = "Collegeville" invoice.DeliveryAddress.PostCode = "CL5 4UT" ' We will add 2 items to the collection. ' Create an new item and add it to the collection Dim itm1 As SimpleHierarchyLib.ItemType = New SimpleHierarchyLib.ItemType() invoice.Item.Add(itm1) itm1.StockCode = 6896 itm1.Description = "A4 Paper (white)" itm1.UnitCost = 495 itm1.Quantity = 15 ' Create an new item and add it to the collection Dim itm2 As SimpleHierarchyLib.ItemType = New SimpleHierarchyLib.ItemType() invoice.Item.Add(itm2) itm2.StockCode = 5161 itm2.Description = "Paper Clips (Large)" itm2.UnitCost = 54 itm2.Quantity = 10 Dim v1 As SimpleHierarchyLib.Vouchers = New SimpleHierarchyLib.Vouchers() invoice.Payment.Vouchers.Add(v1) Dim v2 As SimpleHierarchyLib.Vouchers = New SimpleHierarchyLib.Vouchers() invoice.Payment.Vouchers.Add(v2) Dim v3 As SimpleHierarchyLib.Vouchers = New SimpleHierarchyLib.Vouchers() invoice.Payment.Vouchers.Add(v3) v1.VoucherNo = 546487951 v1.VoucherValue = 5000 v2.VoucherNo = 654646466 v2.VoucherValue = 500 v3.VoucherNo = 654649849 v3.VoucherValue = 2500 ' Now we can look at the XML from this object Console.WriteLine(invoice.ToXml(True, System.Xml.Formatting.Indented, LiquidTechnologies.Runtime.EOLType.CRLF))
|
SimpleHierarchy.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="AddressType"> <xs:sequence> <xs:element name="Forename" type="xs:string"/> <xs:element name="Surname" type="xs:string"/> <xs:element name="AddresLine1" type="xs:string"/> <xs:element name="AddresLine2" type="xs:string"/> <xs:element name="AddresLine3" type="xs:string" minOccurs="0"/> <xs:element name="AddresLine4" type="xs:string" minOccurs="0"/> <xs:element name="AddresLine5" type="xs:string"/> <xs:element name="PostCode" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="ItemType"> <xs:sequence> <xs:element name="StockCode" type="xs:unsignedLong"/> <xs:element name="Description" type="xs:string"/> <xs:element name="UnitCost" type="xs:long"/> <xs:element name="Quantity" type="xs:unsignedInt"/> </xs:sequence> </xs:complexType> <xs:element name="Invoice"> <xs:complexType> <xs:sequence> <xs:element name="InvoiceNo" type="xs:unsignedInt"/> <xs:element name="DeliveryAddress" type="AddressType"/> <xs:element name="BillingAddress" type="AddressType" minOccurs="0"/> <xs:element name="Item" type="ItemType" maxOccurs="unbounded"/> <xs:element name="Payment"> <xs:complexType> <xs:choice> <xs:element name="VISA"> <xs:complexType> <xs:attribute name="CardNo" type="xs:string" use="required"/> <xs:attribute name="Expiry" type="xs:gYearMonth" use="required"/> </xs:complexType> </xs:element> <xs:element name="Vouchers" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="VoucherNo" type="xs:unsignedLong" use="required"/> <xs:attribute name="VoucherValue" type="xs:unsignedLong" use="required"/> </xs:complexType> </xs:element> <xs:element name="Cash"/> </xs:choice> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
Schema Diagrams |
|
AddressType.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: SimpleHierarchy.xsd '********************************************************************************************** Namespace SimpleHierarchyLib ''' <summary> ''' This class represents the ComplexType AddressType ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "AddressType", "", true, false, false)> _ Public Partial Class AddressType Inherits SimpleHierarchyLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for AddressType ''' </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 SimpleHierarchy.xsd ''' </remarks> Public Sub New() _elementName = "AddressType" 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 SimpleHierarchy.xsd. ''' </remarks> Protected Overrides Sub Init() SimpleHierarchyLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _Forename = "" _Surname = "" _AddresLine1 = "" _AddresLine2 = "" _AddresLine3 = Nothing _AddresLine4 = Nothing _AddresLine5 = "" _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 SimpleHierarchyLib.AddressType(_elementName) Dim o As Object newObject._Forename = _Forename newObject._Surname = _Surname newObject._AddresLine1 = _AddresLine1 newObject._AddresLine2 = _AddresLine2 newObject._AddresLine3 = _AddresLine3 newObject._AddresLine4 = _AddresLine4 newObject._AddresLine5 = _AddresLine5 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 - Forename" ''' <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("Forename", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Forename() As String Get Return _Forename End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Forename = value End Set End Property Protected _Forename As String #End Region #Region "Attribute - Surname" ''' <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("Surname", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Surname() As String Get Return _Surname End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Surname = value End Set End Property Protected _Surname As String #End Region #Region "Attribute - AddresLine1" ''' <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("AddresLine1", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property AddresLine1() As String Get Return _AddresLine1 End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _AddresLine1 = value End Set End Property Protected _AddresLine1 As String #End Region #Region "Attribute - AddresLine2" ''' <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("AddresLine2", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property AddresLine2() As String Get Return _AddresLine2 End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _AddresLine2 = value End Set End Property Protected _AddresLine2 As String #End Region #Region "Attribute - AddresLine3" ''' <summary> ''' Represents an optional Element in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' It is optional, initially it is not valid. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimOpt("AddresLine3", "", True, Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property AddresLine3() As String Get Return _AddresLine3 End Get Set(ByVal value As String) If value Is Nothing Then _AddresLine3 = Nothing Else ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _AddresLine3 = value End If End Set End Property Protected _AddresLine3 As String #End Region #Region "Attribute - AddresLine4" ''' <summary> ''' Represents an optional Element in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' It is optional, initially it is not valid. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimOpt("AddresLine4", "", True, Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property AddresLine4() As String Get Return _AddresLine4 End Get Set(ByVal value As String) If value Is Nothing Then _AddresLine4 = Nothing Else ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _AddresLine4 = value End If End Set End Property Protected _AddresLine4 As String #End Region #Region "Attribute - AddresLine5" ''' <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("AddresLine5", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property AddresLine5() As String Get Return _AddresLine5 End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _AddresLine5 = value End Set End Property Protected _AddresLine5 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 |
Invoice.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: SimpleHierarchy.xsd '********************************************************************************************** Namespace SimpleHierarchyLib ''' <summary> ''' This class represents the Element Invoice ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "Invoice", "", true, false, false)> _ Public Partial Class Invoice Inherits SimpleHierarchyLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for Invoice ''' </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 SimpleHierarchy.xsd ''' </remarks> Public Sub New() _elementName = "Invoice" 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 SimpleHierarchy.xsd. ''' </remarks> Protected Overrides Sub Init() SimpleHierarchyLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _InvoiceNo = Convert.ToUInt32(0) _DeliveryAddress = new SimpleHierarchyLib.AddressType("DeliveryAddress") _BillingAddress = Nothing _Item = new SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.ItemType)("Item", "", 1, -1, false) _Payment = new SimpleHierarchyLib.Payment("Payment") ' ##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 SimpleHierarchyLib.Invoice(_elementName) Dim o As Object newObject._InvoiceNo = _InvoiceNo newObject._DeliveryAddress = Nothing If Not _DeliveryAddress Is Nothing Then newObject._DeliveryAddress = CType(_DeliveryAddress.Clone(), SimpleHierarchyLib.AddressType) End If newObject._BillingAddress = Nothing if Not _BillingAddress Is Nothing Then newObject._BillingAddress = CType(_BillingAddress.Clone(), SimpleHierarchyLib.AddressType) End If For Each o In _Item newObject._Item.Add(CType(CType(o, SimpleHierarchyLib.ItemType).Clone(), SimpleHierarchyLib.ItemType)) Next o newObject._Payment = Nothing If Not _Payment Is Nothing Then newObject._Payment = CType(_Payment.Clone(), SimpleHierarchyLib.Payment) 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 - InvoiceNo" ''' <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 Convert.ToUInt32(0). ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("InvoiceNo", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui4, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property InvoiceNo() As UInteger Get Return _InvoiceNo End Get Set(ByVal value As UInteger) _InvoiceNo = value End Set End Property Protected _InvoiceNo As UInteger #End Region #Region "Attribute - DeliveryAddress" ''' <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.ElementInfoSeqClsMnd("DeliveryAddress", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, GetType(SimpleHierarchyLib.AddressType), true)> _ Public Property DeliveryAddress() As SimpleHierarchyLib.AddressType Get Return _DeliveryAddress End Get Set(ByVal value As SimpleHierarchyLib.AddressType) Throw_IfPropertyIsNull(value, "DeliveryAddress") If Not value Is Nothing Then SetElementName(value, "DeliveryAddress") End If _DeliveryAddress = value End Set End Property Protected _DeliveryAddress As SimpleHierarchyLib.AddressType #End Region #Region "Attribute - BillingAddress" ''' <summary> ''' Represents an optional Element in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' It is optional, initially it is Nothing. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqClsOpt("BillingAddress", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, GetType(SimpleHierarchyLib.AddressType))> _ Public Property BillingAddress() As SimpleHierarchyLib.AddressType Get Return _BillingAddress End Get Set(ByVal value As SimpleHierarchyLib.AddressType) If value Is Nothing Then _BillingAddress = Nothing Else SetElementName(value, "BillingAddress") _BillingAddress = value End If End Set End Property Protected _BillingAddress As SimpleHierarchyLib.AddressType #End Region #Region "Attribute - Item" ''' <summary> ''' A collection of Items ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' This collection may contain 1 to Many objects. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqClsCol("Item", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element)> _ Public Readonly Property Item() As SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.ItemType) Get Return _Item End Get End Property Protected _Item As SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.ItemType) #End Region #Region "Attribute - Payment" ''' <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.ElementInfoSeqClsMnd("Payment", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, GetType(SimpleHierarchyLib.Payment), true)> _ Public Property Payment() As SimpleHierarchyLib.Payment Get Return _Payment End Get Set(ByVal value As SimpleHierarchyLib.Payment) Throw_IfPropertyIsNull(value, "Payment") If Not value Is Nothing Then SetElementName(value, "Payment") End If _Payment = value End Set End Property Protected _Payment As SimpleHierarchyLib.Payment #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 |
Payment.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: SimpleHierarchy.xsd '********************************************************************************************** Namespace SimpleHierarchyLib ''' <summary> ''' This class represents the ComplexType Payment ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Choice, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "Payment", "", true, false, false)> _ Public Partial Class Payment Inherits SimpleHierarchyLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for Payment ''' </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 SimpleHierarchy.xsd ''' </remarks> Public Sub New() _elementName = "Payment" 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 SimpleHierarchy.xsd. ''' </remarks> Protected Overrides Sub Init() SimpleHierarchyLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _VISA = Nothing _Vouchers = new SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.Vouchers)("Vouchers", "", 1, -1, false) AddHandler _Vouchers.OnCollectionChange, AddressOf Me.Vouchers_OnChange _Cash = Nothing _validElement = "" ' ##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 Protected Sub ClearChoice(ByVal selectedElement As String) _VISA = Nothing If Not _Vouchers Is Nothing Then If "Vouchers" <> selectedElement Then _Vouchers.Clear() End If End If _Cash = Nothing _validElement = selectedElement 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 SimpleHierarchyLib.Payment(_elementName) Dim o As Object newObject._VISA = Nothing if Not _VISA Is Nothing Then newObject._VISA = CType(_VISA.Clone(), SimpleHierarchyLib.VISA) End If For Each o In _Vouchers newObject._Vouchers.Add(CType(CType(o, SimpleHierarchyLib.Vouchers).Clone(), SimpleHierarchyLib.Vouchers)) Next o newObject._Cash = Nothing If Not _Cash Is Nothing Then newObject._Cash = CType(_Cash.Clone(), LiquidTechnologies.Runtime.Element) End If o = Nothing newObject._validElement = _validElement ' ##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 - VISA" ''' <summary> ''' Represents an optional Element in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' It is optional, initially it is Nothing. ''' Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to Nothing will allow another element to be selected ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoChoiceClsOpt("VISA", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, GetType(SimpleHierarchyLib.VISA))> _ Public Property VISA() As SimpleHierarchyLib.VISA Get Return _VISA End Get Set(ByVal value As SimpleHierarchyLib.VISA) ' The class represents a choice, so prevent more than one element from being selected If value Is Nothing Then ClearChoice("") Else ClearChoice("VISA") ' remove selection If value Is Nothing Then _VISA = Nothing Else SetElementName(value, "VISA") _VISA = value End If End Set End Property Protected _VISA As SimpleHierarchyLib.VISA #End Region #Region "Attribute - Vouchers" ''' <summary> ''' A collection of Voucherss ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' This collection may contain 1 to Many objects. ''' Only one Element within this class may be set at a time. This collection (as a whole is counted as an element) may contain 0 or 1 to Many entries. Emptying the collection allows a different element to be the selected one. If there is already a selected element, and an item is added to this collection then an exception will be raised ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoChoiceClsCol("Vouchers", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element)> _ Public Readonly Property Vouchers() As SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.Vouchers) Get Return _Vouchers End Get End Property ' gets called when the collection changes (allows us to determine if this choice is selected or not) Private Sub Vouchers_OnChange(ByVal o As object, ByVal args As EventArgs) ' The class represents a choice, so prevent more than one element from being selected If _validElement <> "Vouchers" Then If _Vouchers.Count = 0 Then ClearChoice("") Else ClearChoice("Vouchers") ' remove selection End If End Sub Protected _Vouchers As SimpleHierarchyLib.XmlObjectCollection(Of SimpleHierarchyLib.Vouchers) #End Region #Region "Attribute - Cash" ''' <summary> ''' Represents an optional untyped element in the XML document ''' </summary> ''' <remarks> ''' It is optional, initially it is Nothing. ''' Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to Nothing will allow another element to be selected ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoChoiceUntpdOpt("Cash", "", "##any", "")> _ Public Property Cash() As LiquidTechnologies.Runtime.Element Get Return _Cash End Get Set(ByVal value As LiquidTechnologies.Runtime.Element) If Not value Is Nothing Then LiquidTechnologies.Runtime.Element.TestNamespace(value.Namespace, "##any", "") End If ' The class represents a choice, so prevent more than one element from being selected If value Is Nothing Then ClearChoice("") Else ClearChoice("Cash") _Cash = value End Set End Property Protected _Cash As LiquidTechnologies.Runtime.Element #End Region Public Readonly Property ChoiceSelectedElement() As String Get Return _validElement End Get End Property Protected _validElement As String #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 |
VISA.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: SimpleHierarchy.xsd '********************************************************************************************** Namespace SimpleHierarchyLib ''' <summary> ''' This class represents the ComplexType VISA ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "VISA", "", true, false, false)> _ Public Partial Class VISA Inherits SimpleHierarchyLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for VISA ''' </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 SimpleHierarchy.xsd ''' </remarks> Public Sub New() _elementName = "VISA" 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 SimpleHierarchy.xsd. ''' </remarks> Protected Overrides Sub Init() SimpleHierarchyLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _CardNo = "" _Expiry = New LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.gYearMonth) ' ##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 SimpleHierarchyLib.VISA(_elementName) Dim o As Object newObject._CardNo = _CardNo newObject._Expiry = CType(_Expiry.Clone(), LiquidTechnologies.Runtime.XmlDateTime) 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 - CardNo" ''' <summary> ''' Represents a mandatory Attribute in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Attribute in the XML. ''' It is mandatory and therefore must be populated within the XML. ''' It is defaulted to "". ''' </remarks> <LiquidTechnologies.Runtime.AttributeInfoPrimitive("CardNo", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property CardNo() As String Get Return _CardNo End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _CardNo = value End Set End Property Protected _CardNo As String #End Region #Region "Attribute - Expiry" ''' <summary> ''' Represents a mandatory Attribute in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Attribute in the XML. ''' It is mandatory and therefore must be populated within the XML. ''' It is defaulted to New LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.gYearMonth). ''' </remarks> <LiquidTechnologies.Runtime.AttributeInfoPrimitive("Expiry", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_yearMonth, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Expiry() As LiquidTechnologies.Runtime.XmlDateTime Get Return _Expiry End Get Set(ByVal value As LiquidTechnologies.Runtime.XmlDateTime) _Expiry.SetDateTime(value, _Expiry.Type) End Set End Property Protected _Expiry As LiquidTechnologies.Runtime.XmlDateTime #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 |
Vouchers.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: SimpleHierarchy.xsd '********************************************************************************************** Namespace SimpleHierarchyLib ''' <summary> ''' This class represents the ComplexType Vouchers ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "Vouchers", "", true, false, false)> _ Public Partial Class Vouchers Inherits SimpleHierarchyLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for Vouchers ''' </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 SimpleHierarchy.xsd ''' </remarks> Public Sub New() _elementName = "Vouchers" 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 SimpleHierarchy.xsd. ''' </remarks> Protected Overrides Sub Init() SimpleHierarchyLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _VoucherNo = Convert.ToUInt64(0) _VoucherValue = Convert.ToUInt64(0) ' ##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 SimpleHierarchyLib.Vouchers(_elementName) Dim o As Object newObject._VoucherNo = _VoucherNo newObject._VoucherValue = _VoucherValue 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 - VoucherNo" ''' <summary> ''' Represents a mandatory Attribute in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Attribute in the XML. ''' It is mandatory and therefore must be populated within the XML. ''' It is defaulted to Convert.ToUInt64(0). ''' </remarks> <LiquidTechnologies.Runtime.AttributeInfoPrimitive("VoucherNo", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui8, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property VoucherNo() As ULong Get Return _VoucherNo End Get Set(ByVal value As ULong) _VoucherNo = value End Set End Property Protected _VoucherNo As ULong #End Region #Region "Attribute - VoucherValue" ''' <summary> ''' Represents a mandatory Attribute in the XML document ''' </summary> ''' <remarks> ''' This property is represented as an Attribute in the XML. ''' It is mandatory and therefore must be populated within the XML. ''' It is defaulted to Convert.ToUInt64(0). ''' </remarks> <LiquidTechnologies.Runtime.AttributeInfoPrimitive("VoucherValue", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui8, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property VoucherValue() As ULong Get Return _VoucherValue End Get Set(ByVal value As ULong) _VoucherValue = value End Set End Property Protected _VoucherValue As ULong #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 |
ItemType.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: SimpleHierarchy.xsd '********************************************************************************************** Namespace SimpleHierarchyLib ''' <summary> ''' This class represents the ComplexType ItemType ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "ItemType", "", true, false, false)> _ Public Partial Class ItemType Inherits SimpleHierarchyLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for ItemType ''' </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 SimpleHierarchy.xsd ''' </remarks> Public Sub New() _elementName = "ItemType" 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 SimpleHierarchy.xsd. ''' </remarks> Protected Overrides Sub Init() SimpleHierarchyLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _StockCode = Convert.ToUInt64(0) _Description = "" _UnitCost = 0 _Quantity = Convert.ToUInt32(0) ' ##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 SimpleHierarchyLib.ItemType(_elementName) Dim o As Object newObject._StockCode = _StockCode newObject._Description = _Description newObject._UnitCost = _UnitCost newObject._Quantity = _Quantity 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 - StockCode" ''' <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 Convert.ToUInt64(0). ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("StockCode", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui8, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property StockCode() As ULong Get Return _StockCode End Get Set(ByVal value As ULong) _StockCode = value End Set End Property Protected _StockCode As ULong #End Region #Region "Attribute - Description" ''' <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("Description", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Description() As String Get Return _Description End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _Description = value End Set End Property Protected _Description As String #End Region #Region "Attribute - UnitCost" ''' <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("UnitCost", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_i8, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property UnitCost() As Long Get Return _UnitCost End Get Set(ByVal value As Long) _UnitCost = value End Set End Property Protected _UnitCost As Long #End Region #Region "Attribute - Quantity" ''' <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 Convert.ToUInt32(0). ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Quantity", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui4, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property Quantity() As UInteger Get Return _Quantity End Get Set(ByVal value As UInteger) _Quantity = value End Set End Property Protected _Quantity As UInteger #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 |