C# 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
![]() ![]() |
<?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> |
![]() ![]() |
|
SampleRead(MainCls.SamplePath + "Cardinality\\Samples\\Sample2.xml"); public static void SampleRead(string FilePath) { // Create DVD object CardinalityLib.MyRootObject root = new CardinalityLib.MyRootObject(); // Load data into the object from a file root.FromXmlFile(FilePath); // We can now 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); 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 (root.ASimpleStringOptionalElement != null) Console.WriteLine("A Simple String Optional Element = " + root.ASimpleStringOptionalElement); if (root.ASimpleDateOptionalElement != null) Console.WriteLine("A Simple Date Optional Element = " + root.ASimpleDateOptionalElement); if (root.AComplexOptionalElement != null) Console.WriteLine("A Complex Optional Element = " + root.AComplexOptionalElement.ChildItem); // 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. foreach (String str in root.ASimpleStringCollectionElement) Console.WriteLine("A Simple String Collection Element = " + str); foreach (LiquidTechnologies.Runtime.XmlDateTime dt in root.ASimpleDateCollectionElement) Console.WriteLine("A Simple Date Collection Element = " + dt); foreach (CardinalityLib.AComplexCollectionElement elm in root.AComplexCollectionElement) Console.WriteLine("A Simple String Collection Element = " + elm.ChildItem);
|
![]() ![]() |
|
CardinalityLib.MyRootObject root = 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));
|
![]() ![]() |
<?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> |
![]() ![]() |
![]() |
![]() ![]() |
���using System; using System.Xml; /********************************************************************************************** * Copyright (c) 2001-2025 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 } } |
![]() ![]() |
���using System; using System.Xml; /********************************************************************************************** * Copyright (c) 2001-2025 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 : 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 AComplexCollectionElement() { _elementName = "AComplexCollectionElement"; Init(); } public AComplexCollectionElement(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_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 } #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.AComplexCollectionElement newObject = new CardinalityLib.AComplexCollectionElement(_elementName); newObject.m_ChildItem = m_ChildItem; // ##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 - 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", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)] public string ChildItem { get { return m_ChildItem; } set { // Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value); m_ChildItem = value; } } protected string m_ChildItem; #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 } } |
![]() ![]() |
���using System; using System.Xml; /********************************************************************************************** * Copyright (c) 2001-2025 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 : 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 AComplexMandatoryElement() { _elementName = "AComplexMandatoryElement"; Init(); } public AComplexMandatoryElement(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_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 } #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.AComplexMandatoryElement newObject = new CardinalityLib.AComplexMandatoryElement(_elementName); newObject.m_ChildItem = m_ChildItem; // ##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 - 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", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)] public string ChildItem { get { return m_ChildItem; } set { // Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value); m_ChildItem = value; } } protected string m_ChildItem; #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 } } |
![]() ![]() |
���using System; using System.Xml; /********************************************************************************************** * Copyright (c) 2001-2025 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 : 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 AComplexOptionalElement() { _elementName = "AComplexOptionalElement"; Init(); } public AComplexOptionalElement(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_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 } #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.AComplexOptionalElement newObject = new CardinalityLib.AComplexOptionalElement(_elementName); newObject.m_ChildItem = m_ChildItem; // ##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 - 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", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)] public string ChildItem { get { return m_ChildItem; } set { // Apply whitespace rules appropriately value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value); m_ChildItem = value; } } protected string m_ChildItem; #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 } } |
Main Menu | Samples List |