Liquid XML Data Binder 2020
Liquid XML Data Binder (C++, Java, VB6) / Examples / Simple Sequence / Example Usage / Missing Optional Elements / Visual Basic 6 Sample : Simple Sequence
In This Topic
    Visual Basic 6 Sample : Simple Sequence
    In This Topic
    VERSION 1.0 CLASS
    BEGIN
      MultiUse = -1  'True
      Persistable = 0  'NotPersistable
      DataBindingBehavior = 0  'vbNone
      DataSourceBehavior  = 0  'vbNone
      MTSTransactionMode  = 0  'NotAnMTSObject
    END
    Attribute VB_Name = "DVD"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = True
    Attribute VB_PredeclaredId = False
    Attribute VB_Exposed = True
    Option Explicit
    '**********************************************************************************************
    '* Copyright (c) 2001-2020 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 17.0.1.9233
    '* Using Schema: SimpleSequence.xsd
    '**********************************************************************************************
    Private m_ElementName As String
    Private mvarIsValidGenre As Boolean 
    Private mvarGenre As String 
    Private mvarCost As Double 
    Private mvarTitle As String 
    Private mvarDescription As String 
    Private mvarReleaseDate As LtXmlComLib18.DateTime 
    ' ##HAND_CODED_BLOCK_START ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    ' Add Additional Variable Declarations...
    
    ' ##HAND_CODED_BLOCK_END ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    Implements LtXmlComLib18.XmlObjectBase
    Implements LtXmlComLib18.XmlGeneratedClass
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''' Properties '''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    Public Property Get ElementName() As String
        ElementName = m_elementName
    End Property
    
    ' Summary:
    '       Represents an optional Attribute in the XML document
    '       
    ' Remarks:
    '        
    '       This property is represented as an Attribute in the XML. 
    '       It is optional, initially it is not valid. 
    Public Property Get Genre As String 
        if mvarIsValidGenre = false then
            Err.Raise ERR_INVALID_STATE, "DVD.Genre", "The Property Genre is not valid. Set GenreValid = true"
        end if
        Genre = mvarGenre
    End Property
    
    Public Property Let Genre(ByVal value As String)
        ' Apply whitespace rules appropriately
        value = LtXmlComLib18.WhitespaceUtils.PreserveWhitespace(value)
        mvarIsValidGenre = true
        mvarGenre = value
    End Property
    
    ' Summary:
    '       Indicates if Genre contains a valid value.
    ' Remarks:
    '       true if the value for Genre is valid, false if not. 
    '       If this is set to true then the property is considered valid, and assigned its
    '       default value (). 
    '       If its set to false then its made invalid, and subsequent calls to get Genre
    '       will raise an exception. 
    Public Property Get IsValidGenre As Boolean 
        IsValidGenre = mvarIsValidGenre
    End Property
                
    Public Property Let IsValidGenre(ByVal value As Boolean)
        if value <> mvarIsValidGenre then
            mvarGenre = LtXmlComLib18.Conversions.stringFromString("", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Preserve)
            mvarIsValidGenre = value
        End if
    End Property
    
    ' Summary:
    '       Represents a mandatory Attribute in the XML document
    '       
    ' 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 0. 
    Public Property Get Cost As Double 
        Cost = mvarCost
    End Property
    
    Public Property Let Cost(ByVal value As Double)
        mvarCost = value
        
    End Property
    ' Summary:
    '       Represents a mandatory Element in the XML document
    '       
    ' Remarks:
    '        
    '       This property is represented as an Element in the XML. 
    '       It is mandatory and therefore must be populated within the XML. 
    '       It is defaulted to . 
    Public Property Get Title As String 
        Title = mvarTitle
    End Property
    
    Public Property Let Title(ByVal value As String)
        ' Apply whitespace rules appropriately
        value = LtXmlComLib18.WhitespaceUtils.PreserveWhitespace(value)
        mvarTitle = value
        
    End Property
    ' Summary:
    '       Represents a mandatory Element in the XML document
    '       
    ' Remarks:
    '        
    '       This property is represented as an Element in the XML. 
    '       It is mandatory and therefore must be populated within the XML. 
    '       It is defaulted to . 
    Public Property Get Description As String 
        Description = mvarDescription
    End Property
    
    Public Property Let Description(ByVal value As String)
        ' Apply whitespace rules appropriately
        value = LtXmlComLib18.WhitespaceUtils.PreserveWhitespace(value)
        mvarDescription = value
        
    End Property
    ' Summary:
    '       Represents a mandatory Element in the XML document
    '       
    ' Remarks:
    '        
    '       This property is represented as an Element in the XML. 
    '       It is mandatory and therefore must be populated within the XML. 
    '       It is defaulted to 1900-01-01. 
    Public Property Get ReleaseDate As LtXmlComLib18.DateTime 
        Set ReleaseDate = mvarReleaseDate
    End Property
    
    Public Property Set ReleaseDate(ByVal value As LtXmlComLib18.DateTime)
        mvarReleaseDate.SetDateTimeWithType value, mvarReleaseDate.dateType 
        
    End Property
        
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''' Standard Methods '''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    Public Sub ToXmlFile(ByVal FileName As String, Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib18.XmlFormatting = LtXmlComLib18.XmlFormatting_Indented, Optional encoding As LtXmlComLib18.XmlEncoding = LtXmlComLib18.XmlEncoding_UTF8, Optional EOL As LtXmlComLib18.EOLType = LtXmlComLib18.EOLType.EOLType_CRLF, Optional context As LtXmlComLib18.XmlSerializationContext = Nothing)
        RegisterProduct
        LtXmlComLib18.XmlObjectBaseHelper.ToXmlFile Me, FileName, includeDocHeader, formatting, encoding, EOL, context
    End Sub
    Public Function ToXml(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib18.XmlFormatting = LtXmlComLib18.XmlFormatting_Indented, Optional EOL As LtXmlComLib18.EOLType = LtXmlComLib18.EOLType.EOLType_LF, Optional context As LtXmlComLib18.XmlSerializationContext = Nothing) As String
        RegisterProduct
        ToXml = LtXmlComLib18.XmlObjectBaseHelper.ToXml(Me, includeDocHeader, formatting, EOL, context)
    End Function
    Public Function ToXmlStream(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib18.XmlFormatting = LtXmlComLib18.XmlFormatting_Indented, Optional encoding As LtXmlComLib18.XmlEncoding = LtXmlComLib18.XmlEncoding_UTF8, Optional EOL As LtXmlComLib18.EOLType = LtXmlComLib18.EOLType.EOLType_LF, Optional context As LtXmlComLib18.XmlSerializationContext = Nothing) As Variant
        RegisterProduct
        ToXmlStream = LtXmlComLib18.XmlObjectBaseHelper.ToXmlStream(Me, includeDocHeader, formatting, encoding, EOL, context)
    End Function
    Public Sub FromXml(ByVal xmlIn As String, Optional context As LtXmlComLib18.XmlSerializationContext = Nothing)
        RegisterProduct
        LtXmlComLib18.XmlObjectBaseHelper.FromXml Me, xmlIn, context
    End Sub
    Public Sub FromXmlFile(ByVal FileName As String, Optional context As LtXmlComLib18.XmlSerializationContext = Nothing)
        RegisterProduct
        LtXmlComLib18.XmlObjectBaseHelper.FromXmlFile Me, FileName, context
    End Sub
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''' Private Methods  ''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    ' Summary:
    '       Constructor for DVD
    ' 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 SimpleSequence.xsd 
    Private Sub Class_Initialize()
        m_elementName = "DVD"
        XmlGeneratedClass_Init
    End Sub
    
    
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''' Implementation of XmlObjectBase '''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    Private Sub XmlObjectBase_PrivateSetElementName(ByVal vNewValue As String)
        m_ElementName = vNewValue
    End Sub
    
    Private Property Get XmlObjectBase_ElementName() As String
        XmlObjectBase_ElementName = m_ElementName
    End Property
    
    Private Property Get XmlObjectBase_TargetNamespace() As String
        XmlObjectBase_TargetNamespace = ""
    End Property
    
    Private Function XmlObjectBase_IsSuitableSubstitution(ByVal InterfaceName As String) As Boolean
        XmlObjectBase_IsSuitableSubstitution = false
        if InterfaceName = "DVD" _
            then XmlObjectBase_IsSuitableSubstitution = true
    End Function
    
    Private Property Get XmlObjectBase_Namespace() As String
        XmlObjectBase_Namespace = ""
    End Property
    
    Private Function XmlObjectBase_FromXmlInt(ByVal XMLParent As MSXML2.IXMLDOMElement, ByVal XMLChild As MSXML2.IXMLDOMElement, ByVal context As LtXmlComLib18.XmlSerializationContext, ByVal isOptionalChoice As Boolean) As MSXML2.IXMLDOMElement
        Set XmlObjectBase_FromXmlInt = XmlGeneratedClassHelper.FromXml(Me, XMLParent, XMLChild, context, isOptionalChoice)
    End Function
    Private Sub XmlObjectBase_ToXmlInt(ByVal xmlOut As LtXmlComLib18.XmlTextWriter, ByVal bRegisterNamespaces As Boolean, ByVal NamespaceUri As String, ByVal context As LtXmlComLib18.XmlSerializationContext, ByVal isOptionalChoice As Boolean)
        XmlGeneratedClassHelper.ToXml Me, xmlOut, bRegisterNamespaces, NamespaceUri, context, isOptionalChoice
    End Sub
    Private Sub XmlObjectBase_AttributesToXmlInt(ByVal xmlOut As LtXmlComLib18.XmlTextWriter, ByVal context As LtXmlComLib18.XmlSerializationContext)
        XmlGeneratedClassHelper.AttributesToXml Me, xmlOut, context
    End Sub
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''' Implementation of XmlGeneratedClass '''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    ' Summary:
    '       Initializes the class
    ' Remarks:
    '       The Creates all the mandatory fields (populated with the default data) 
    '       All Collection object are created.
    '       However any 1-n relationships (these are represented as collections) are
    '       empty. To comply with the schema these must be populated before the xml
    '       obtained from ToXml is valid against the schema SimpleSequence.xsd.
    Private Sub XmlGeneratedClass_Init()
        mvarGenre = LtXmlComLib18.Conversions.stringFromString("", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Preserve)
        mvarIsValidGenre = False
        mvarCost = LtXmlComLib18.Conversions.r8FromString("0", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Collapse)
        mvarTitle = LtXmlComLib18.Conversions.stringFromString("", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Preserve)
        mvarDescription = LtXmlComLib18.Conversions.stringFromString("", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Preserve)
        Set mvarReleaseDate = LtXmlComLib18.Conversions.dateFromString("1900-01-01", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Collapse)
        
    
    
    
        ' Force Init ClassInfo
        Dim classInfo As LtXmlComLib18.ClassInfo
        Set classInfo = XmlGeneratedClass_ClassInfo
    
    ' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    ' Add Additional Init Settings...
    
    ' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    End Sub 
    
    Private Property Get XmlGeneratedClass_ClassInfo() As LtXmlComLib18.ClassInfo
        If g_ClsDataDVD Is Nothing Then
            Set g_ClsDataDVD = New LtXmlComLib18.ClassInfo
            
            g_ClsDataDVD.GroupType = LtXmlComLib18.XmlGroupType.Sequence
            g_ClsDataDVD.ElementType = LtXmlComLib18.XmlElementType.Element
            g_ClsDataDVD.ElementName = "DVD"
            g_ClsDataDVD.ElementNamespaceURI = ""
            g_ClsDataDVD.FromXmlFailIfAttributeUnknown = true
            g_ClsDataDVD.IsClassDerived = false
            g_ClsDataDVD.PrimitiveDataType = LtXmlComLib18.XmlDataType.type_none
            g_ClsDataDVD.PrimitiveFormatOverride = ""
            g_ClsDataDVD.OutputPrimitiveClassAsTextProperty = False
            Set g_ClsDataDVD.ClassFactory = General.CF
            
            g_ClsDataDVD.AddElmSeqPrimMnd "Title", "", "Title", XmlDataType.type_string, "", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1
            g_ClsDataDVD.AddElmSeqPrimMnd "Description", "", "Description", XmlDataType.type_string, "", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1
            g_ClsDataDVD.AddElmSeqPrimMnd "ReleaseDate", "", "ReleaseDate", XmlDataType.type_date, "", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Collapse, "", -1, -1, "", "", "", "", -1
           g_ClsDataDVD.AddAttrPrimitive "Genre", "", "Genre", "IsValidGenre", true, XmlDataType.type_string, "", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Preserve, "", -1, -1, "", "", "", "", -1, vbNullString
           g_ClsDataDVD.AddAttrPrimitive "Cost", "", "Cost", "", false, XmlDataType.type_r8, "", LtXmlComLib18.WhitespaceRule.WhitespaceRule_Collapse, "", -1, -1, "", "", "", "", -1, vbNullString
        End If
        Set XmlGeneratedClass_ClassInfo = g_ClsDataDVD
    End Property
    
    ' ##HAND_CODED_BLOCK_START ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    ' Add Additional Methods/Properties Here...
    
    ' ##HAND_CODED_BLOCK_END ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    
    
    
    
    

    Main Menu Samples List