VB.Net Sample : Cardinality
Schema Summary This sample shows how to deal with mandatory, optional and collections of elements. Schema Details Sample Description The sample demonstrates how to read and write from optional, mandatory and collections of elements, when only the bare minimum of data is included in the XML document. |
Sample XML File
Sample2.xml |
<?xml version="1.0" encoding="UTF-8"?> <MyRootObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\Cardinality.xsd"> <ASimpleStringMandatoryElement>Some Required Data</ASimpleStringMandatoryElement> <ASimpleDateMandatoryElement>2003-11-23</ASimpleDateMandatoryElement> <AComplexMandatoryElement> <ChildItem>Some More Required Data</ChildItem> </AComplexMandatoryElement> </MyRootObject> |
Read Sample | |
SampleRead(Module1.SamplePath + "Cardinality\Samples\Sample2.xml") Public Shared Sub SampleRead(ByVal FilePath As String) ' Create DVD object Dim root As CardinalityLib.MyRootObject = New CardinalityLib.MyRootObject() ' Load data into the object from a file root.FromXmlFile(FilePath) ' Now we can look at the mandatory elements ' These are simple they are always there, ' and can be accessed without checking they exist first Console.WriteLine("A Simple String Mandatory Element = " + root.ASimpleStringMandatoryElement) Console.WriteLine("A Simple Date Mandatory Element = " + root.ASimpleDateMandatoryElement.ToString()) Console.WriteLine("A Complex Mandatory Element = " + root.AComplexMandatoryElement.ChildItem) ' Now we can look at the optional elements. ' Because these may be missing in the xml document ' we need to check that they exist before accessing them by testing for null. ' Note ' Simple Types are defined as Nullable Types e.g. int? If (Not root.ASimpleStringOptionalElement Is Nothing) Then Console.WriteLine("A Simple String Optional Element = " + root.ASimpleStringOptionalElement) End If If (Not root.ASimpleDateOptionalElement Is Nothing) Then Console.WriteLine("A Simple Date Optional Element = " + root.ASimpleDateOptionalElement.ToString()) End If If (Not root.AComplexOptionalElement Is Nothing) Then Console.WriteLine("A Complex Optional Element = " + root.AComplexOptionalElement.ChildItem) End If ' Now we can look at the collections of elements. ' A collections object is always provided within the parent object ' even if no of objects are always present in the xml document. Dim str As String For Each str In root.ASimpleStringCollectionElement Console.WriteLine("A Simple String Collection Element = " + str) Next str Dim dt As LiquidTechnologies.Runtime.XmlDateTime For Each dt In root.ASimpleDateCollectionElement Console.WriteLine("A Simple Date Collection Element = " + dt.ToString()) Next dt Dim elm As CardinalityLib.AComplexCollectionElement For Each elm In root.AComplexCollectionElement Console.WriteLine("A Simple String Collection Element = " + elm.ChildItem) Next elm
|
Write Sample | |
Dim root As CardinalityLib.MyRootObject = New CardinalityLib.MyRootObject() ' Mandatory items can just be set root.ASimpleStringMandatoryElement = "Some Required Data" root.ASimpleDateMandatoryElement.SetDate(2003, 11, 23) root.AComplexMandatoryElement.ChildItem = "Some More Required Data" ' if we don't want any of the optional elements then we just don't set them up. ' Now we can look at the XML from this object Console.WriteLine(root.ToXml(True, System.Xml.Formatting.Indented, LiquidTechnologies.Runtime.EOLType.CRLF))
|
Cardinality.xsd |
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="MyRootObject"> <xs:complexType> <xs:sequence> <xs:element name="ASimpleStringMandatoryElement" type="xs:string"/> <xs:element name="ASimpleDateMandatoryElement" type="xs:date"/> <xs:element name="AComplexMandatoryElement"> <xs:complexType> <xs:sequence> <xs:element name="ChildItem" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ASimpleStringOptionalElement" type="xs:string" minOccurs="0"/> <xs:element name="ASimpleDateOptionalElement" type="xs:date" minOccurs="0"/> <xs:element name="AComplexOptionalElement" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="ChildItem" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ASimpleStringCollectionElement" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ASimpleDateCollectionElement" type="xs:date" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="AComplexCollectionElement" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="ChildItem" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
Schema Diagrams |
|
MyRootObject.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: Cardinality.xsd '********************************************************************************************** Namespace CardinalityLib ''' <summary> ''' This class represents the Element MyRootObject ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "MyRootObject", "", true, false, false)> _ Public Partial Class MyRootObject Inherits CardinalityLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for MyRootObject ''' </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 Cardinality.xsd ''' </remarks> Public Sub New() _elementName = "MyRootObject" 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 Cardinality.xsd. ''' </remarks> Protected Overrides Sub Init() CardinalityLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _ASimpleStringMandatoryElement = "" _ASimpleDateMandatoryElement = New LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.date) _AComplexMandatoryElement = new CardinalityLib.AComplexMandatoryElement("AComplexMandatoryElement") _ASimpleStringOptionalElement = Nothing _ASimpleDateOptionalElement = Nothing _AComplexOptionalElement = Nothing _ASimpleStringCollectionElement = new CardinalityLib.XmlSimpleTypeCollection(Of String)("ASimpleStringCollectionElement", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, 0, -1, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, new LiquidTechnologies.Runtime.PrimitiveRestrictions("", -1, -1, "", "", "", "", -1, -1, -1)) _ASimpleDateCollectionElement = new CardinalityLib.XmlSimpleTypeCollection(Of LiquidTechnologies.Runtime.XmlDateTime)("ASimpleDateCollectionElement", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_date, 0, -1, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, new LiquidTechnologies.Runtime.PrimitiveRestrictions("", -1, -1, "", "", "", "", -1, -1, -1)) _AComplexCollectionElement = new CardinalityLib.XmlObjectCollection(Of CardinalityLib.AComplexCollectionElement)("AComplexCollectionElement", "", 0, -1, false) ' ##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 CardinalityLib.MyRootObject(_elementName) Dim o As Object newObject._ASimpleStringMandatoryElement = _ASimpleStringMandatoryElement newObject._ASimpleDateMandatoryElement = CType(_ASimpleDateMandatoryElement.Clone(), LiquidTechnologies.Runtime.XmlDateTime) newObject._AComplexMandatoryElement = Nothing If Not _AComplexMandatoryElement Is Nothing Then newObject._AComplexMandatoryElement = CType(_AComplexMandatoryElement.Clone(), CardinalityLib.AComplexMandatoryElement) End If newObject._ASimpleStringOptionalElement = _ASimpleStringOptionalElement If _ASimpleDateOptionalElement Is Nothing Then newObject._ASimpleDateOptionalElement = Nothing Else newObject._ASimpleDateOptionalElement = CType(_ASimpleDateOptionalElement.Clone(), LiquidTechnologies.Runtime.XmlDateTime) End If newObject._AComplexOptionalElement = Nothing if Not _AComplexOptionalElement Is Nothing Then newObject._AComplexOptionalElement = CType(_AComplexOptionalElement.Clone(), CardinalityLib.AComplexOptionalElement) End If For Each o in _ASimpleStringCollectionElement newObject._ASimpleStringCollectionElement.Add(CType(o, String)) Next o For Each o in _ASimpleDateCollectionElement newObject._ASimpleDateCollectionElement.Add(CType(CType(o, LiquidTechnologies.Runtime.XmlDateTime).Clone(), LiquidTechnologies.Runtime.XmlDateTime)) Next o For Each o In _AComplexCollectionElement newObject._AComplexCollectionElement.Add(CType(CType(o, CardinalityLib.AComplexCollectionElement).Clone(), CardinalityLib.AComplexCollectionElement)) Next o 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 - ASimpleStringMandatoryElement" ''' <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("ASimpleStringMandatoryElement", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property ASimpleStringMandatoryElement() As String Get Return _ASimpleStringMandatoryElement End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _ASimpleStringMandatoryElement = value End Set End Property Protected _ASimpleStringMandatoryElement As String #End Region #Region "Attribute - ASimpleDateMandatoryElement" ''' <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 New LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.date). ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("ASimpleDateMandatoryElement", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_date, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property ASimpleDateMandatoryElement() As LiquidTechnologies.Runtime.XmlDateTime Get Return _ASimpleDateMandatoryElement End Get Set(ByVal value As LiquidTechnologies.Runtime.XmlDateTime) _ASimpleDateMandatoryElement.SetDateTime(value, _ASimpleDateMandatoryElement.Type) End Set End Property Protected _ASimpleDateMandatoryElement As LiquidTechnologies.Runtime.XmlDateTime #End Region #Region "Attribute - AComplexMandatoryElement" ''' <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("AComplexMandatoryElement", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, GetType(CardinalityLib.AComplexMandatoryElement), true)> _ Public Property AComplexMandatoryElement() As CardinalityLib.AComplexMandatoryElement Get Return _AComplexMandatoryElement End Get Set(ByVal value As CardinalityLib.AComplexMandatoryElement) Throw_IfPropertyIsNull(value, "AComplexMandatoryElement") If Not value Is Nothing Then SetElementName(value, "AComplexMandatoryElement") End If _AComplexMandatoryElement = value End Set End Property Protected _AComplexMandatoryElement As CardinalityLib.AComplexMandatoryElement #End Region #Region "Attribute - ASimpleStringOptionalElement" ''' <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("ASimpleStringOptionalElement", "", True, Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property ASimpleStringOptionalElement() As String Get Return _ASimpleStringOptionalElement End Get Set(ByVal value As String) If value Is Nothing Then _ASimpleStringOptionalElement = Nothing Else ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _ASimpleStringOptionalElement = value End If End Set End Property Protected _ASimpleStringOptionalElement As String #End Region #Region "Attribute - ASimpleDateOptionalElement" ''' <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("ASimpleDateOptionalElement", "", True, Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_date, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property ASimpleDateOptionalElement() As LiquidTechnologies.Runtime.XmlDateTime Get Return _ASimpleDateOptionalElement End Get Set(ByVal value As LiquidTechnologies.Runtime.XmlDateTime) If value Is Nothing Then _ASimpleDateOptionalElement = Nothing Else If _ASimpleDateOptionalElement Is Nothing Then _ASimpleDateOptionalElement = New LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.date) End If _ASimpleDateOptionalElement.SetDateTime(value, _ASimpleDateOptionalElement.Type) End If End Set End Property Protected _ASimpleDateOptionalElement As LiquidTechnologies.Runtime.XmlDateTime #End Region #Region "Attribute - AComplexOptionalElement" ''' <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("AComplexOptionalElement", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, GetType(CardinalityLib.AComplexOptionalElement))> _ Public Property AComplexOptionalElement() As CardinalityLib.AComplexOptionalElement Get Return _AComplexOptionalElement End Get Set(ByVal value As CardinalityLib.AComplexOptionalElement) If value Is Nothing Then _AComplexOptionalElement = Nothing Else SetElementName(value, "AComplexOptionalElement") _AComplexOptionalElement = value End If End Set End Property Protected _AComplexOptionalElement As CardinalityLib.AComplexOptionalElement #End Region #Region "Attribute - ASimpleStringCollectionElement" ''' <summary> ''' A collection of Strings ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' This collection may contain 0 to Many Strings. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimCol("ASimpleStringCollectionElement", "")> _ Public Readonly Property ASimpleStringCollectionElement() As CardinalityLib.XmlSimpleTypeCollection(Of String) Get Return _ASimpleStringCollectionElement End Get End Property Protected _ASimpleStringCollectionElement As CardinalityLib.XmlSimpleTypeCollection(Of String) #End Region #Region "Attribute - ASimpleDateCollectionElement" ''' <summary> ''' A collection of LiquidTechnologies.Runtime.XmlDateTimes ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' This collection may contain 0 to Many LiquidTechnologies.Runtime.XmlDateTimes. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqPrimCol("ASimpleDateCollectionElement", "")> _ Public Readonly Property ASimpleDateCollectionElement() As CardinalityLib.XmlSimpleTypeCollection(Of LiquidTechnologies.Runtime.XmlDateTime) Get Return _ASimpleDateCollectionElement End Get End Property Protected _ASimpleDateCollectionElement As CardinalityLib.XmlSimpleTypeCollection(Of LiquidTechnologies.Runtime.XmlDateTime) #End Region #Region "Attribute - AComplexCollectionElement" ''' <summary> ''' A collection of AComplexCollectionElements ''' </summary> ''' <remarks> ''' This property is represented as an Element in the XML. ''' This collection may contain 0 to Many objects. ''' </remarks> <LiquidTechnologies.Runtime.ElementInfoSeqClsCol("AComplexCollectionElement", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element)> _ Public Readonly Property AComplexCollectionElement() As CardinalityLib.XmlObjectCollection(Of CardinalityLib.AComplexCollectionElement) Get Return _AComplexCollectionElement End Get End Property Protected _AComplexCollectionElement As CardinalityLib.XmlObjectCollection(Of CardinalityLib.AComplexCollectionElement) #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 |
AComplexCollectionElement.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: Cardinality.xsd '********************************************************************************************** Namespace CardinalityLib ''' <summary> ''' This class represents the ComplexType AComplexCollectionElement ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "AComplexCollectionElement", "", true, false, false)> _ Public Partial Class AComplexCollectionElement Inherits CardinalityLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for AComplexCollectionElement ''' </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 Cardinality.xsd ''' </remarks> Public Sub New() _elementName = "AComplexCollectionElement" 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 Cardinality.xsd. ''' </remarks> Protected Overrides Sub Init() CardinalityLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _ChildItem = "" ' ##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 CardinalityLib.AComplexCollectionElement(_elementName) Dim o As Object newObject._ChildItem = _ChildItem 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 - ChildItem" ''' <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("ChildItem", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property ChildItem() As String Get Return _ChildItem End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _ChildItem = value End Set End Property Protected _ChildItem 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 |
AComplexMandatoryElement.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: Cardinality.xsd '********************************************************************************************** Namespace CardinalityLib ''' <summary> ''' This class represents the ComplexType AComplexMandatoryElement ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "AComplexMandatoryElement", "", true, false, false)> _ Public Partial Class AComplexMandatoryElement Inherits CardinalityLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for AComplexMandatoryElement ''' </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 Cardinality.xsd ''' </remarks> Public Sub New() _elementName = "AComplexMandatoryElement" 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 Cardinality.xsd. ''' </remarks> Protected Overrides Sub Init() CardinalityLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _ChildItem = "" ' ##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 CardinalityLib.AComplexMandatoryElement(_elementName) Dim o As Object newObject._ChildItem = _ChildItem 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 - ChildItem" ''' <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("ChildItem", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property ChildItem() As String Get Return _ChildItem End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _ChildItem = value End Set End Property Protected _ChildItem 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 |
AComplexOptionalElement.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: Cardinality.xsd '********************************************************************************************** Namespace CardinalityLib ''' <summary> ''' This class represents the ComplexType AComplexOptionalElement ''' </summary> <LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence, _ LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, _ "AComplexOptionalElement", "", true, false, false)> _ Public Partial Class AComplexOptionalElement Inherits CardinalityLib.XmlCommonBase #Region "Constructors" ''' <summary> ''' Constructor for AComplexOptionalElement ''' </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 Cardinality.xsd ''' </remarks> Public Sub New() _elementName = "AComplexOptionalElement" 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 Cardinality.xsd. ''' </remarks> Protected Overrides Sub Init() CardinalityLib.Registration.iRegistrationIndicator = 0 ' causes registration to take place _ChildItem = "" ' ##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 CardinalityLib.AComplexOptionalElement(_elementName) Dim o As Object newObject._ChildItem = _ChildItem 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 - ChildItem" ''' <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("ChildItem", "", Nothing, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, Nothing, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, Nothing)> _ Public Property ChildItem() As String Get Return _ChildItem End Get Set(ByVal value As String) ' Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value) _ChildItem = value End Set End Property Protected _ChildItem 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 |
Main Menu | Samples List |