In This Topic
    MyRootObject.cs
    In This Topic
    ��using System;
    using 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 : 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 MyRootObject()
            {
                _elementName = "MyRootObject";
                Init();
            }
            public MyRootObject(string elementName)
            {
                _elementName = elementName;
                Init();
            }
            #endregion
    
            #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 override void Init()
            {
                CardinalityLib.Registration.iRegistrationIndicator = 0; // causes registration to take place
                m_ASimpleStringMandatoryElement = "";
                m_ASimpleDateMandatoryElement = new LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.date);
                m_AComplexMandatoryElement = new CardinalityLib.AComplexMandatoryElement("AComplexMandatoryElement");
                m_ASimpleStringOptionalElement = null;
                m_ASimpleDateOptionalElement = null;
                m_AComplexOptionalElement = null;
                m_ASimpleStringCollectionElement = new CardinalityLib.XmlSimpleTypeCollection<string>("ASimpleStringCollectionElement", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, 0, -1, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, new LiquidTechnologies.Runtime.PrimitiveRestrictions("", -1, -1, "", "", "", "", -1, -1, -1));
                m_ASimpleDateCollectionElement = new CardinalityLib.XmlSimpleTypeCollection<LiquidTechnologies.Runtime.XmlDateTime>("ASimpleDateCollectionElement", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_date, 0, -1, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, new LiquidTechnologies.Runtime.PrimitiveRestrictions("", -1, -1, "", "", "", "", -1, -1, -1));
                m_AComplexCollectionElement = new CardinalityLib.XmlObjectCollection<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
            }
            #endregion
    
            #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 override object Clone()
            {
                CardinalityLib.MyRootObject newObject = new CardinalityLib.MyRootObject(_elementName);
                newObject.m_ASimpleStringMandatoryElement = m_ASimpleStringMandatoryElement;
                newObject.m_ASimpleDateMandatoryElement = (LiquidTechnologies.Runtime.XmlDateTime)m_ASimpleDateMandatoryElement.Clone();
                newObject.m_AComplexMandatoryElement = null;
                if (m_AComplexMandatoryElement != null)
                    newObject.m_AComplexMandatoryElement = (CardinalityLib.AComplexMandatoryElement)m_AComplexMandatoryElement.Clone();
                newObject.m_ASimpleStringOptionalElement = m_ASimpleStringOptionalElement;
                if (m_ASimpleDateOptionalElement == null)
                    newObject.m_ASimpleDateOptionalElement = null;
                else
                    newObject.m_ASimpleDateOptionalElement = (LiquidTechnologies.Runtime.XmlDateTime)m_ASimpleDateOptionalElement.Clone();
                newObject.m_AComplexOptionalElement = null;
                if (m_AComplexOptionalElement != null)
                    newObject.m_AComplexOptionalElement = (CardinalityLib.AComplexOptionalElement)m_AComplexOptionalElement.Clone();
                foreach (string o in m_ASimpleStringCollectionElement)
                    newObject.m_ASimpleStringCollectionElement.Add(o);
                foreach (LiquidTechnologies.Runtime.XmlDateTime o in m_ASimpleDateCollectionElement)
                    newObject.m_ASimpleDateCollectionElement.Add((LiquidTechnologies.Runtime.XmlDateTime)o.Clone());
                foreach (CardinalityLib.AComplexCollectionElement o in m_AComplexCollectionElement)
                    newObject.m_AComplexCollectionElement.Add((CardinalityLib.AComplexCollectionElement)o.Clone());
    
    // ##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;
            }
            #endregion
    
            #region Member variables
    
            protected override string TargetNamespace
            {
                get { return ""; }
            }
    
            #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", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
            public string ASimpleStringMandatoryElement
            {
                get
                {
                    return m_ASimpleStringMandatoryElement;
                }
                set 
                {
                    // Apply whitespace rules appropriately
                    value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
                    m_ASimpleStringMandatoryElement = value;
                }
            }
            protected string m_ASimpleStringMandatoryElement;
    
            #endregion
    
            #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", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_date, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
            public LiquidTechnologies.Runtime.XmlDateTime ASimpleDateMandatoryElement
            {
                get
                {
                    return m_ASimpleDateMandatoryElement;
                }
                set 
                {
                    m_ASimpleDateMandatoryElement.SetDateTime(value, m_ASimpleDateMandatoryElement.Type); 
                }
            }
            protected LiquidTechnologies.Runtime.XmlDateTime m_ASimpleDateMandatoryElement;
    
            #endregion
    
            #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 null an exception is raised.
            /// </remarks>
            [LiquidTechnologies.Runtime.ElementInfoSeqClsMnd("AComplexMandatoryElement", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, typeof(CardinalityLib.AComplexMandatoryElement), true)]
            public CardinalityLib.AComplexMandatoryElement AComplexMandatoryElement
            {
                get 
                { 
                    return m_AComplexMandatoryElement;  
                }
                set 
                { 
                    Throw_IfPropertyIsNull(value, "AComplexMandatoryElement");
                    if (value != null)
                        SetElementName(value, "AComplexMandatoryElement");
                    m_AComplexMandatoryElement = value;
                }
            }
            protected CardinalityLib.AComplexMandatoryElement m_AComplexMandatoryElement;
            
            #endregion
    
            #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, null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
            public string ASimpleStringOptionalElement
            {
                get 
                { 
                    return m_ASimpleStringOptionalElement;  
                }
                set 
                { 
                    if (value == null)
                    {
                        m_ASimpleStringOptionalElement = null;
                    }
                    else
                    {
                        // Apply whitespace rules appropriately
                        value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value); 
                        m_ASimpleStringOptionalElement = value;
                    }
                }
            }
            protected string m_ASimpleStringOptionalElement;
            #endregion
    
            #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, null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_date, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
            public LiquidTechnologies.Runtime.XmlDateTime ASimpleDateOptionalElement
            {
                get 
                { 
                    return m_ASimpleDateOptionalElement;  
                }
                set 
                { 
                    if (value == null)
                    {
                        m_ASimpleDateOptionalElement = null;
                    }
                    else
                    {
                        if (m_ASimpleDateOptionalElement == null)
                            m_ASimpleDateOptionalElement = new LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.date);
                        m_ASimpleDateOptionalElement.SetDateTime(value, m_ASimpleDateOptionalElement.Type);
                    }
                }
            }
            protected LiquidTechnologies.Runtime.XmlDateTime m_ASimpleDateOptionalElement;
            #endregion
    
            #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 null.
            /// </remarks>
            [LiquidTechnologies.Runtime.ElementInfoSeqClsOpt("AComplexOptionalElement", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, typeof(CardinalityLib.AComplexOptionalElement))]
            public CardinalityLib.AComplexOptionalElement AComplexOptionalElement
            {
                get
                { 
                    return m_AComplexOptionalElement;
                }
                set
                { 
                    if (value == null)
                        m_AComplexOptionalElement = null;
                    else
                    {
                        SetElementName(value, "AComplexOptionalElement");
                        m_AComplexOptionalElement = value; 
                    }
                }
            }
            protected CardinalityLib.AComplexOptionalElement m_AComplexOptionalElement;
            
            #endregion
    
            #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 CardinalityLib.XmlSimpleTypeCollection<string> ASimpleStringCollectionElement
            {
                get { return m_ASimpleStringCollectionElement; }
            }
            protected CardinalityLib.XmlSimpleTypeCollection<string> m_ASimpleStringCollectionElement;
    
            #endregion
    
            #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 CardinalityLib.XmlSimpleTypeCollection<LiquidTechnologies.Runtime.XmlDateTime> ASimpleDateCollectionElement
            {
                get { return m_ASimpleDateCollectionElement; }
            }
            protected CardinalityLib.XmlSimpleTypeCollection<LiquidTechnologies.Runtime.XmlDateTime> m_ASimpleDateCollectionElement;
    
            #endregion
    
            #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 CardinalityLib.XmlObjectCollection<CardinalityLib.AComplexCollectionElement> AComplexCollectionElement
            {
                get { return m_AComplexCollectionElement; }
            }
            protected CardinalityLib.XmlObjectCollection<CardinalityLib.AComplexCollectionElement> m_AComplexCollectionElement;
    
            #endregion
    
            #region Attribute - Namespace
            public override string Namespace
            {
                get { return ""; }
            }    
            #endregion    
    
            #region Attribute - GetBase
            public override LiquidTechnologies.Runtime.XmlObjectBase GetBase()
            {
                return this;
            }
            #endregion
            #endregion
    
    
    // ##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
        }
    }