C# Sample : Simple Hierarchy
| Schema Summary This sample shows a number of elements within a Hierarchy. It includes local (anonymous) & global complex types. It also shows how collections are manipulated within sequences & choices. Schema Details This schema contains 2 globally defined elements AddressType, ItemType and Invoice. All of these objects can be used as the documentElement (root element) in a valid XML document. The Invoice object also contains a sequence, the sequence contains a number of child elements; InvoiceNo is a primitive DeliveryAddress is a element that conforms to the global element AddressType. BillingAddress is an optional (the corresponding property on the Invoice object may contain a null because of this) element that conforms to the global element AddressType. Item is a collection of elements conforming to the global element ItemType. Payment is a locally defined element, it in turn contains a choice of; an element 'VISA' or a collection of 'Vouchers' elements or an element 'Cash' which is untyped within the schema, and represented as a string within the generated code. Sample Description The sample builds on the previous sample, and demonstrates how to deal with a choice that contains a collection of elements. |
Sample XML File
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\SimpleHierarchy.xsd">
<InvoiceNo>564</InvoiceNo>
<DeliveryAddress>
<Forename>Joe</Forename>
<Surname>Bloggs</Surname>
<AddresLine1>23 Summers lane</AddresLine1>
<AddresLine2>Wintersville</AddresLine2>
<AddresLine5>Stoke</AddresLine5>
<PostCode>SK4 8LS</PostCode>
</DeliveryAddress>
<BillingAddress>
<Forename>Jane</Forename>
<Surname>Doe</Surname>
<AddresLine1>Acme Account</AddresLine1>
<AddresLine2>Acme House</AddresLine2>
<AddresLine3>523 Hogarth Lane</AddresLine3>
<AddresLine5>Collegeville</AddresLine5>
<PostCode>CL5 4UT</PostCode>
</BillingAddress>
<Item>
<StockCode>6896</StockCode>
<Description>A4 Paper (white)</Description>
<UnitCost>495</UnitCost>
<Quantity>15</Quantity>
</Item>
<Item>
<StockCode>5161</StockCode>
<Description>Paper Clips (Large)</Description>
<UnitCost>54</UnitCost>
<Quantity>10</Quantity>
</Item>
<Payment>
<Vouchers VoucherNo="546487951" VoucherValue="5000"/>
<Vouchers VoucherNo="654646466" VoucherValue="500"/>
<Vouchers VoucherNo="654649849" VoucherValue="2500"/>
</Payment>
</Invoice>
|
string FilePath = MainCls.SamplePath + "SimpleHierarchy\\Samples\\Sample2.xml";
// Create Invoice object
SimpleHierarchyLib.Invoice invoice = new SimpleHierarchyLib.Invoice();
// Load data into the object from a file
invoice.FromXmlFile(FilePath);
// Now we can look at the data
Console.WriteLine("Invoice No = {0}", invoice.InvoiceNo);
// look at the billing address
// The billing address is optional, so we need to check it has been provided
if (invoice.BillingAddress != null)
{
Console.WriteLine("Billing Addresss");
Console.WriteLine(" Forename = {0}", invoice.BillingAddress.Forename);
Console.WriteLine(" Surname = {0}", invoice.BillingAddress.Surname);
Console.WriteLine(" Address Line 1 = {0}", invoice.BillingAddress.AddresLine1);
Console.WriteLine(" Address Line 2 = {0}", invoice.BillingAddress.AddresLine2);
// AddresLine3 & AddresLine4 are optional, so check they are valid before using them
if (invoice.BillingAddress.AddresLine3 != null)
Console.WriteLine(" Address Line 3 = {0}", invoice.BillingAddress.AddresLine3);
if (invoice.BillingAddress.AddresLine4 != null)
Console.WriteLine(" Address Line 4 = {0}", invoice.BillingAddress.AddresLine4);
Console.WriteLine(" Address Line 5 = {0}", invoice.BillingAddress.AddresLine5);
Console.WriteLine(" Postcode = {0}", invoice.BillingAddress.PostCode);
}
// look at the Shipping address
Console.WriteLine("Billing Addresss");
Console.WriteLine(" Forename = {0}", invoice.DeliveryAddress.Forename);
Console.WriteLine(" Surname = {0}", invoice.DeliveryAddress.Surname);
Console.WriteLine(" Address Line 1 = {0}", invoice.DeliveryAddress.AddresLine1);
Console.WriteLine(" Address Line 2 = {0}", invoice.DeliveryAddress.AddresLine2);
// AddresLine3 & AddresLine4 are optional, so check they are valid before using them
if (invoice.DeliveryAddress.AddresLine3 != null)
Console.WriteLine(" Address Line 3 = {0}", invoice.DeliveryAddress.AddresLine3);
if (invoice.DeliveryAddress.AddresLine4 != null)
Console.WriteLine(" Address Line 4 = {0}", invoice.DeliveryAddress.AddresLine4);
Console.WriteLine(" Address Line 5 = {0}", invoice.DeliveryAddress.AddresLine5);
Console.WriteLine(" Postcode = {0}", invoice.DeliveryAddress.PostCode);
// look at all the items in the invoice
Console.WriteLine("There are {0} items in the order", invoice.Item.Count);
foreach (SimpleHierarchyLib.ItemType itm in invoice.Item)
{
Console.WriteLine("Item");
Console.WriteLine(" StockCode = {0}", itm.StockCode);
Console.WriteLine(" Description = {0}", itm.Description);
Console.WriteLine(" UnitCost = {0}", itm.UnitCost);
Console.WriteLine(" Quantity = {0}", itm.Quantity);
}
// now look at the Payment method, this is a choice in the schema,
// so only one option is posible
if (invoice.Payment.ChoiceSelectedElement == "Cash")
{
Console.WriteLine("The invoice was paid in Cash");
}
else if (invoice.Payment.ChoiceSelectedElement == "VISA")
{
Console.WriteLine("The invoice was paid with a VISA Card");
Console.WriteLine(" Card Number = {0}", invoice.Payment.VISA.CardNo);
Console.WriteLine(" Card Expiry = {0}", invoice.Payment.VISA.Expiry);
}
else if (invoice.Payment.ChoiceSelectedElement == "Vouchers")
{
Console.WriteLine("The invoice was paid with Vouchers");
foreach (SimpleHierarchyLib.Vouchers v in invoice.Payment.Vouchers)
{
Console.WriteLine("Voucher");
Console.WriteLine(" Number = {0}", v.VoucherNo);
Console.WriteLine(" Value = {0}", v.VoucherValue);
}
}
else
{
Console.WriteLine("Unknown selected element {0}", invoice.Payment.ChoiceSelectedElement);
}
|
// Create Invoice object
SimpleHierarchyLib.Invoice invoice = new SimpleHierarchyLib.Invoice();
// Now we can look at the data
invoice.InvoiceNo = 564;
// because the BillingAddress is optional, we need to populate
// this property before using it.
invoice.BillingAddress = new SimpleHierarchyLib.AddressType();
invoice.BillingAddress.Forename = "Joe";
invoice.BillingAddress.Surname = "Bloggs";
invoice.BillingAddress.AddresLine1 = "23 Summers lane";
invoice.BillingAddress.AddresLine2 = "Wintersville";
invoice.BillingAddress.AddresLine5 = "Stoke";
invoice.BillingAddress.PostCode = "SK4 8LS";
invoice.DeliveryAddress = new SimpleHierarchyLib.AddressType();
invoice.DeliveryAddress.Forename = "Jane";
invoice.DeliveryAddress.Surname = "Doe";
invoice.DeliveryAddress.AddresLine1 = "Acme Account";
invoice.DeliveryAddress.AddresLine2 = "Acme House";
// This is an optional field, setting it makes it appear in the output xml
invoice.DeliveryAddress.AddresLine3 = "523 Hogarth Lane";
invoice.DeliveryAddress.AddresLine5 = "Collegeville";
invoice.DeliveryAddress.PostCode = "CL5 4UT";
// We will add 2 items to the collection.
// Create an new item and add it to the collection
SimpleHierarchyLib.ItemType itm1 = new SimpleHierarchyLib.ItemType();
invoice.Item.Add(itm1);
itm1.StockCode = 6896;
itm1.Description = "A4 Paper (white)";
itm1.UnitCost = 495;
itm1.Quantity = 15;
// Create an new item and add it to the collection
SimpleHierarchyLib.ItemType itm2 = new SimpleHierarchyLib.ItemType();
invoice.Item.Add(itm2);
itm2.StockCode = 5161;
itm2.Description = "Paper Clips (Large)";
itm2.UnitCost = 54;
itm2.Quantity = 10;
SimpleHierarchyLib.Vouchers v1 = new SimpleHierarchyLib.Vouchers();
invoice.Payment.Vouchers.Add(v1);
SimpleHierarchyLib.Vouchers v2 = new SimpleHierarchyLib.Vouchers();
invoice.Payment.Vouchers.Add(v2);
SimpleHierarchyLib.Vouchers v3 = new SimpleHierarchyLib.Vouchers();
invoice.Payment.Vouchers.Add(v3);
v1.VoucherNo = 546487951;
v1.VoucherValue = 5000;
v2.VoucherNo = 654646466;
v2.VoucherValue = 500;
v3.VoucherNo = 654649849;
v3.VoucherValue = 2500;
// Now we can look at the XML from this object
Console.WriteLine(invoice.ToXml(true, System.Xml.Formatting.Indented, LiquidTechnologies.Runtime.EOLType.CRLF));
|
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="AddressType">
<xs:sequence>
<xs:element name="Forename" type="xs:string"/>
<xs:element name="Surname" type="xs:string"/>
<xs:element name="AddresLine1" type="xs:string"/>
<xs:element name="AddresLine2" type="xs:string"/>
<xs:element name="AddresLine3" type="xs:string" minOccurs="0"/>
<xs:element name="AddresLine4" type="xs:string" minOccurs="0"/>
<xs:element name="AddresLine5" type="xs:string"/>
<xs:element name="PostCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ItemType">
<xs:sequence>
<xs:element name="StockCode" type="xs:unsignedLong"/>
<xs:element name="Description" type="xs:string"/>
<xs:element name="UnitCost" type="xs:long"/>
<xs:element name="Quantity" type="xs:unsignedInt"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Invoice">
<xs:complexType>
<xs:sequence>
<xs:element name="InvoiceNo" type="xs:unsignedInt"/>
<xs:element name="DeliveryAddress" type="AddressType"/>
<xs:element name="BillingAddress" type="AddressType" minOccurs="0"/>
<xs:element name="Item" type="ItemType" maxOccurs="unbounded"/>
<xs:element name="Payment">
<xs:complexType>
<xs:choice>
<xs:element name="VISA">
<xs:complexType>
<xs:attribute name="CardNo" type="xs:string" use="required"/>
<xs:attribute name="Expiry" type="xs:gYearMonth" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Vouchers" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="VoucherNo" type="xs:unsignedLong" use="required"/>
<xs:attribute name="VoucherValue" type="xs:unsignedLong" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Cash"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
|
![]() |
���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: SimpleHierarchy.xsd
**********************************************************************************************/
namespace SimpleHierarchyLib
{
/// <summary>
/// This class represents the ComplexType AddressType
/// </summary>
[LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence,
LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element,
"AddressType", "", true, false, false)]
public partial class AddressType : SimpleHierarchyLib.XmlCommonBase
{
#region Constructors
/// <summary>
/// Constructor for AddressType
/// </summary>
/// <remarks>
/// The class is created with all the mandatory fields populated with the
/// default data.
/// All Collection object are created.
/// However any 1-n relationships (these are represented as collections) are
/// empty. To comply with the schema these must be populated before the xml
/// obtained from ToXml is valid against the schema SimpleHierarchy.xsd
/// </remarks>
public AddressType()
{
_elementName = "AddressType";
Init();
}
public AddressType(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 SimpleHierarchy.xsd.
/// </remarks>
protected override void Init()
{
SimpleHierarchyLib.Registration.iRegistrationIndicator = 0; // causes registration to take place
m_Forename = "";
m_Surname = "";
m_AddresLine1 = "";
m_AddresLine2 = "";
m_AddresLine3 = null;
m_AddresLine4 = null;
m_AddresLine5 = "";
m_PostCode = "";
// ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional initialization code here...
// ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}
#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()
{
SimpleHierarchyLib.AddressType newObject = new SimpleHierarchyLib.AddressType(_elementName);
newObject.m_Forename = m_Forename;
newObject.m_Surname = m_Surname;
newObject.m_AddresLine1 = m_AddresLine1;
newObject.m_AddresLine2 = m_AddresLine2;
newObject.m_AddresLine3 = m_AddresLine3;
newObject.m_AddresLine4 = m_AddresLine4;
newObject.m_AddresLine5 = m_AddresLine5;
newObject.m_PostCode = m_PostCode;
// ##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 - Forename
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Forename", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string Forename
{
get
{
return m_Forename;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_Forename = value;
}
}
protected string m_Forename;
#endregion
#region Attribute - Surname
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Surname", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string Surname
{
get
{
return m_Surname;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_Surname = value;
}
}
protected string m_Surname;
#endregion
#region Attribute - AddresLine1
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("AddresLine1", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string AddresLine1
{
get
{
return m_AddresLine1;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_AddresLine1 = value;
}
}
protected string m_AddresLine1;
#endregion
#region Attribute - AddresLine2
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("AddresLine2", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string AddresLine2
{
get
{
return m_AddresLine2;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_AddresLine2 = value;
}
}
protected string m_AddresLine2;
#endregion
#region Attribute - AddresLine3
/// <summary>
/// Represents an optional Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is optional, initially it is not valid.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimOpt("AddresLine3", "", true, null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string AddresLine3
{
get
{
return m_AddresLine3;
}
set
{
if (value == null)
{
m_AddresLine3 = null;
}
else
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_AddresLine3 = value;
}
}
}
protected string m_AddresLine3;
#endregion
#region Attribute - AddresLine4
/// <summary>
/// Represents an optional Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is optional, initially it is not valid.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimOpt("AddresLine4", "", true, null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string AddresLine4
{
get
{
return m_AddresLine4;
}
set
{
if (value == null)
{
m_AddresLine4 = null;
}
else
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_AddresLine4 = value;
}
}
}
protected string m_AddresLine4;
#endregion
#region Attribute - AddresLine5
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("AddresLine5", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string AddresLine5
{
get
{
return m_AddresLine5;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_AddresLine5 = value;
}
}
protected string m_AddresLine5;
#endregion
#region Attribute - PostCode
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("PostCode", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string PostCode
{
get
{
return m_PostCode;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_PostCode = value;
}
}
protected string m_PostCode;
#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: SimpleHierarchy.xsd
**********************************************************************************************/
namespace SimpleHierarchyLib
{
/// <summary>
/// This class represents the Element Invoice
/// </summary>
[LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence,
LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element,
"Invoice", "", true, false, false)]
public partial class Invoice : SimpleHierarchyLib.XmlCommonBase
{
#region Constructors
/// <summary>
/// Constructor for Invoice
/// </summary>
/// <remarks>
/// The class is created with all the mandatory fields populated with the
/// default data.
/// All Collection object are created.
/// However any 1-n relationships (these are represented as collections) are
/// empty. To comply with the schema these must be populated before the xml
/// obtained from ToXml is valid against the schema SimpleHierarchy.xsd
/// </remarks>
public Invoice()
{
_elementName = "Invoice";
Init();
}
public Invoice(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 SimpleHierarchy.xsd.
/// </remarks>
protected override void Init()
{
SimpleHierarchyLib.Registration.iRegistrationIndicator = 0; // causes registration to take place
m_InvoiceNo = 0;
m_DeliveryAddress = new SimpleHierarchyLib.AddressType("DeliveryAddress");
m_BillingAddress = null;
m_Item = new SimpleHierarchyLib.XmlObjectCollection<SimpleHierarchyLib.ItemType>("Item", "", 1, -1, false);
m_Payment = new SimpleHierarchyLib.Payment("Payment");
// ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional initialization code here...
// ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}
#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()
{
SimpleHierarchyLib.Invoice newObject = new SimpleHierarchyLib.Invoice(_elementName);
newObject.m_InvoiceNo = m_InvoiceNo;
newObject.m_DeliveryAddress = null;
if (m_DeliveryAddress != null)
newObject.m_DeliveryAddress = (SimpleHierarchyLib.AddressType)m_DeliveryAddress.Clone();
newObject.m_BillingAddress = null;
if (m_BillingAddress != null)
newObject.m_BillingAddress = (SimpleHierarchyLib.AddressType)m_BillingAddress.Clone();
foreach (SimpleHierarchyLib.ItemType o in m_Item)
newObject.m_Item.Add((SimpleHierarchyLib.ItemType)o.Clone());
newObject.m_Payment = null;
if (m_Payment != null)
newObject.m_Payment = (SimpleHierarchyLib.Payment)m_Payment.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 - InvoiceNo
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to 0.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("InvoiceNo", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui4, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public uint InvoiceNo
{
get
{
return m_InvoiceNo;
}
set
{
m_InvoiceNo = value;
}
}
protected uint m_InvoiceNo;
#endregion
#region Attribute - DeliveryAddress
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// If this property is set, then the object will be COPIED. If the property is set to null an exception is raised.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqClsMnd("DeliveryAddress", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, typeof(SimpleHierarchyLib.AddressType), true)]
public SimpleHierarchyLib.AddressType DeliveryAddress
{
get
{
return m_DeliveryAddress;
}
set
{
Throw_IfPropertyIsNull(value, "DeliveryAddress");
if (value != null)
SetElementName(value, "DeliveryAddress");
m_DeliveryAddress = value;
}
}
protected SimpleHierarchyLib.AddressType m_DeliveryAddress;
#endregion
#region Attribute - BillingAddress
/// <summary>
/// Represents an optional Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is optional, initially it is null.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqClsOpt("BillingAddress", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, typeof(SimpleHierarchyLib.AddressType))]
public SimpleHierarchyLib.AddressType BillingAddress
{
get
{
return m_BillingAddress;
}
set
{
if (value == null)
m_BillingAddress = null;
else
{
SetElementName(value, "BillingAddress");
m_BillingAddress = value;
}
}
}
protected SimpleHierarchyLib.AddressType m_BillingAddress;
#endregion
#region Attribute - Item
/// <summary>
/// A collection of Items
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// This collection may contain 1 to Many objects.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqClsCol("Item", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element)]
public SimpleHierarchyLib.XmlObjectCollection<SimpleHierarchyLib.ItemType> Item
{
get { return m_Item; }
}
protected SimpleHierarchyLib.XmlObjectCollection<SimpleHierarchyLib.ItemType> m_Item;
#endregion
#region Attribute - Payment
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// If this property is set, then the object will be COPIED. If the property is set to null an exception is raised.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqClsMnd("Payment", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, typeof(SimpleHierarchyLib.Payment), true)]
public SimpleHierarchyLib.Payment Payment
{
get
{
return m_Payment;
}
set
{
Throw_IfPropertyIsNull(value, "Payment");
if (value != null)
SetElementName(value, "Payment");
m_Payment = value;
}
}
protected SimpleHierarchyLib.Payment m_Payment;
#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: SimpleHierarchy.xsd
**********************************************************************************************/
namespace SimpleHierarchyLib
{
/// <summary>
/// This class represents the ComplexType Payment
/// </summary>
[LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Choice,
LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element,
"Payment", "", true, false, false)]
public partial class Payment : SimpleHierarchyLib.XmlCommonBase
{
#region Constructors
/// <summary>
/// Constructor for Payment
/// </summary>
/// <remarks>
/// The class is created with all the mandatory fields populated with the
/// default data.
/// All Collection object are created.
/// However any 1-n relationships (these are represented as collections) are
/// empty. To comply with the schema these must be populated before the xml
/// obtained from ToXml is valid against the schema SimpleHierarchy.xsd
/// </remarks>
public Payment()
{
_elementName = "Payment";
Init();
}
public Payment(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 SimpleHierarchy.xsd.
/// </remarks>
protected override void Init()
{
SimpleHierarchyLib.Registration.iRegistrationIndicator = 0; // causes registration to take place
m_VISA = null;
m_Vouchers = new SimpleHierarchyLib.XmlObjectCollection<SimpleHierarchyLib.Vouchers>("Vouchers", "", 1, -1, false);
m_Vouchers.OnCollectionChange += new SimpleHierarchyLib.XmlObjectCollection<SimpleHierarchyLib.Vouchers>.OnCollectionChangeEvent(this.Vouchers_OnChange);
m_Cash = null;
_validElement = "";
// ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional initialization code here...
// ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}
protected void ClearChoice(string selectedElement)
{
m_VISA = null;
if (m_Vouchers != null)
{
if ("Vouchers" != selectedElement)
m_Vouchers.Clear();
}
m_Cash = null;
_validElement = selectedElement;
}
#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()
{
SimpleHierarchyLib.Payment newObject = new SimpleHierarchyLib.Payment(_elementName);
newObject.m_VISA = null;
if (m_VISA != null)
newObject.m_VISA = (SimpleHierarchyLib.VISA)m_VISA.Clone();
foreach (SimpleHierarchyLib.Vouchers o in m_Vouchers)
newObject.m_Vouchers.Add((SimpleHierarchyLib.Vouchers)o.Clone());
newObject.m_Cash = null;
if (m_Cash != null)
newObject.m_Cash = (LiquidTechnologies.Runtime.Element)m_Cash.Clone();
newObject._validElement = _validElement;
// ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional clone code here...
// ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
return newObject;
}
#endregion
#region Member variables
protected override string TargetNamespace
{
get { return ""; }
}
#region Attribute - VISA
/// <summary>
/// Represents an optional Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is optional, initially it is null.
/// Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to null will allow another element to be selected
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoChoiceClsOpt("VISA", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element, typeof(SimpleHierarchyLib.VISA))]
public SimpleHierarchyLib.VISA VISA
{
get
{
return m_VISA;
}
set
{
// The class represents a choice, so prevent more than one element from being selected
ClearChoice((value == null)?"":"VISA"); // remove selection
if (value == null)
m_VISA = null;
else
{
SetElementName(value, "VISA");
m_VISA = value;
}
}
}
protected SimpleHierarchyLib.VISA m_VISA;
#endregion
#region Attribute - Vouchers
/// <summary>
/// A collection of Voucherss
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// This collection may contain 1 to Many objects.
/// Only one Element within this class may be set at a time. This collection (as a whole is counted as an element) may contain 0 or 1 to Many entries. Emptying the collection allows a different element to be the selected one. If there is already a selected element, and an item is added to this collection then an exception will be raised
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoChoiceClsCol("Vouchers", "", LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element)]
public SimpleHierarchyLib.XmlObjectCollection<SimpleHierarchyLib.Vouchers> Vouchers
{
get { return m_Vouchers; }
}
// gets called when the collection changes (allows us to determine if this choice is selected or not)
private void Vouchers_OnChange(object o, EventArgs args)
{
// The class represents a choice, so prevent more than one element from being selected
if (_validElement != "Vouchers")
{
ClearChoice(m_Vouchers.Count == 0?"":"Vouchers"); // remove selection
}
}
protected SimpleHierarchyLib.XmlObjectCollection<SimpleHierarchyLib.Vouchers> m_Vouchers;
#endregion
#region Attribute - Cash
/// <summary>
/// Represents an optional untyped element in the XML document
/// </summary>
/// <remarks>
/// It is optional, initially it is null.
/// Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to null will allow another element to be selected
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoChoiceUntpdOpt("Cash", "", "##any", "")]
public LiquidTechnologies.Runtime.Element Cash
{
get
{
return m_Cash;
}
set
{
if (value != null)
LiquidTechnologies.Runtime.Element.TestNamespace(value.Namespace, "##any", "");
// The class represents a choice, so prevent more than one element from being selected
ClearChoice((value == null)?"":"Cash");
m_Cash = value;
}
}
protected LiquidTechnologies.Runtime.Element m_Cash;
#endregion
public string ChoiceSelectedElement
{
get { return _validElement; }
}
protected string _validElement;
#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: SimpleHierarchy.xsd
**********************************************************************************************/
namespace SimpleHierarchyLib
{
/// <summary>
/// This class represents the ComplexType VISA
/// </summary>
[LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence,
LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element,
"VISA", "", true, false, false)]
public partial class VISA : SimpleHierarchyLib.XmlCommonBase
{
#region Constructors
/// <summary>
/// Constructor for VISA
/// </summary>
/// <remarks>
/// The class is created with all the mandatory fields populated with the
/// default data.
/// All Collection object are created.
/// However any 1-n relationships (these are represented as collections) are
/// empty. To comply with the schema these must be populated before the xml
/// obtained from ToXml is valid against the schema SimpleHierarchy.xsd
/// </remarks>
public VISA()
{
_elementName = "VISA";
Init();
}
public VISA(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 SimpleHierarchy.xsd.
/// </remarks>
protected override void Init()
{
SimpleHierarchyLib.Registration.iRegistrationIndicator = 0; // causes registration to take place
m_CardNo = "";
m_Expiry = new LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.gYearMonth);
// ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional initialization code here...
// ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}
#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()
{
SimpleHierarchyLib.VISA newObject = new SimpleHierarchyLib.VISA(_elementName);
newObject.m_CardNo = m_CardNo;
newObject.m_Expiry = (LiquidTechnologies.Runtime.XmlDateTime)m_Expiry.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 - CardNo
/// <summary>
/// Represents a mandatory Attribute in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Attribute in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.AttributeInfoPrimitive("CardNo", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string CardNo
{
get
{
return m_CardNo;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_CardNo = value;
}
}
protected string m_CardNo;
#endregion
#region Attribute - Expiry
/// <summary>
/// Represents a mandatory Attribute in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Attribute in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to new LiquidTechnologies.Runtime.XmlDateTime(LiquidTechnologies.Runtime.XmlDateTime.DateType.gYearMonth).
/// </remarks>
[LiquidTechnologies.Runtime.AttributeInfoPrimitive("Expiry", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_yearMonth, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public LiquidTechnologies.Runtime.XmlDateTime Expiry
{
get
{
return m_Expiry;
}
set
{
m_Expiry.SetDateTime(value, m_Expiry.Type);
}
}
protected LiquidTechnologies.Runtime.XmlDateTime m_Expiry;
#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: SimpleHierarchy.xsd
**********************************************************************************************/
namespace SimpleHierarchyLib
{
/// <summary>
/// This class represents the ComplexType Vouchers
/// </summary>
[LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence,
LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element,
"Vouchers", "", true, false, false)]
public partial class Vouchers : SimpleHierarchyLib.XmlCommonBase
{
#region Constructors
/// <summary>
/// Constructor for Vouchers
/// </summary>
/// <remarks>
/// The class is created with all the mandatory fields populated with the
/// default data.
/// All Collection object are created.
/// However any 1-n relationships (these are represented as collections) are
/// empty. To comply with the schema these must be populated before the xml
/// obtained from ToXml is valid against the schema SimpleHierarchy.xsd
/// </remarks>
public Vouchers()
{
_elementName = "Vouchers";
Init();
}
public Vouchers(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 SimpleHierarchy.xsd.
/// </remarks>
protected override void Init()
{
SimpleHierarchyLib.Registration.iRegistrationIndicator = 0; // causes registration to take place
m_VoucherNo = 0;
m_VoucherValue = 0;
// ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional initialization code here...
// ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}
#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()
{
SimpleHierarchyLib.Vouchers newObject = new SimpleHierarchyLib.Vouchers(_elementName);
newObject.m_VoucherNo = m_VoucherNo;
newObject.m_VoucherValue = m_VoucherValue;
// ##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 - VoucherNo
/// <summary>
/// Represents a mandatory Attribute in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Attribute in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to 0.
/// </remarks>
[LiquidTechnologies.Runtime.AttributeInfoPrimitive("VoucherNo", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui8, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public ulong VoucherNo
{
get
{
return m_VoucherNo;
}
set
{
m_VoucherNo = value;
}
}
protected ulong m_VoucherNo;
#endregion
#region Attribute - VoucherValue
/// <summary>
/// Represents a mandatory Attribute in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Attribute in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to 0.
/// </remarks>
[LiquidTechnologies.Runtime.AttributeInfoPrimitive("VoucherValue", "", LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui8, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public ulong VoucherValue
{
get
{
return m_VoucherValue;
}
set
{
m_VoucherValue = value;
}
}
protected ulong m_VoucherValue;
#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: SimpleHierarchy.xsd
**********************************************************************************************/
namespace SimpleHierarchyLib
{
/// <summary>
/// This class represents the ComplexType ItemType
/// </summary>
[LiquidTechnologies.Runtime.XmlObjectInfo(LiquidTechnologies.Runtime.XmlObjectBase.XmlElementGroupType.Sequence,
LiquidTechnologies.Runtime.XmlObjectBase.XmlElementType.Element,
"ItemType", "", true, false, false)]
public partial class ItemType : SimpleHierarchyLib.XmlCommonBase
{
#region Constructors
/// <summary>
/// Constructor for ItemType
/// </summary>
/// <remarks>
/// The class is created with all the mandatory fields populated with the
/// default data.
/// All Collection object are created.
/// However any 1-n relationships (these are represented as collections) are
/// empty. To comply with the schema these must be populated before the xml
/// obtained from ToXml is valid against the schema SimpleHierarchy.xsd
/// </remarks>
public ItemType()
{
_elementName = "ItemType";
Init();
}
public ItemType(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 SimpleHierarchy.xsd.
/// </remarks>
protected override void Init()
{
SimpleHierarchyLib.Registration.iRegistrationIndicator = 0; // causes registration to take place
m_StockCode = 0;
m_Description = "";
m_UnitCost = 0;
m_Quantity = 0;
// ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional initialization code here...
// ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}
#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()
{
SimpleHierarchyLib.ItemType newObject = new SimpleHierarchyLib.ItemType(_elementName);
newObject.m_StockCode = m_StockCode;
newObject.m_Description = m_Description;
newObject.m_UnitCost = m_UnitCost;
newObject.m_Quantity = m_Quantity;
// ##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 - StockCode
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to 0.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("StockCode", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui8, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public ulong StockCode
{
get
{
return m_StockCode;
}
set
{
m_StockCode = value;
}
}
protected ulong m_StockCode;
#endregion
#region Attribute - Description
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to "".
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Description", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_string, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Preserve, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public string Description
{
get
{
return m_Description;
}
set
{
// Apply whitespace rules appropriately
value = LiquidTechnologies.Runtime.WhitespaceUtils.Preserve(value);
m_Description = value;
}
}
protected string m_Description;
#endregion
#region Attribute - UnitCost
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to 0.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("UnitCost", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_i8, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public long UnitCost
{
get
{
return m_UnitCost;
}
set
{
m_UnitCost = value;
}
}
protected long m_UnitCost;
#endregion
#region Attribute - Quantity
/// <summary>
/// Represents a mandatory Element in the XML document
/// </summary>
/// <remarks>
/// This property is represented as an Element in the XML.
/// It is mandatory and therefore must be populated within the XML.
/// It is defaulted to 0.
/// </remarks>
[LiquidTechnologies.Runtime.ElementInfoSeqPrimMnd("Quantity", "", null, LiquidTechnologies.Runtime.Conversions.ConversionType.type_ui4, null, LiquidTechnologies.Runtime.WhitespaceUtils.WhitespaceRule.Collapse, "", -1, -1, "", "", "", "", -1, -1, -1, null)]
public uint Quantity
{
get
{
return m_Quantity;
}
set
{
m_Quantity = value;
}
}
protected uint m_Quantity;
#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 |