Send feedback on this topic.
Teradata.Client.Provider
GetXmlSchema Method (TdDecimal)
Example 



Teradata.Client.Provider Namespace > TdDecimal Structure : GetXmlSchema Method
Holds zero or more XML Schema definition language (XSD) schemas.
Specifies the XML Qualified name for TdDecimal XML type mapping.
Syntax
'Declaration
 
Public Shared Function GetXmlSchema( _
   ByVal xmlSchemaSet As XmlSchemaSet _
) As XmlQualifiedName
'Usage
 
Dim xmlSchemaSet As XmlSchemaSet
Dim value As XmlQualifiedName
 
value = TdDecimal.GetXmlSchema(xmlSchemaSet)
public static XmlQualifiedName GetXmlSchema( 
   XmlSchemaSet xmlSchemaSet
)
public:
static XmlQualifiedName^ GetXmlSchema( 
   XmlSchemaSet^ xmlSchemaSet
) 

Parameters

xmlSchemaSet
Holds zero or more XML Schema definition language (XSD) schemas.

Return Value

Returns xs:decimal since it can support large decimals with 38 precision.
Example
This examples shows how to use TdDecimal with Xml.Serialization.XmlSerializer class. Xml.Serialization.XmlElementAttribute is used to indicate that the Advanced SQL Engine column can be Null.
public class Order
{
    public DateTime Date;
            
    public Int32 ProductId;
            
    public Int32 Quantity;
            
    public Int32? BackOrderQuantity;
            
    [XmlElementAttribute(IsNullable = true)]        
    public TdDecimal BackOrderPrice;
}
             
internal class OrderWriter
{
              
    public static void Write()
    {
        // Setup the order
        Order x = new Order();
              
        x.Date = DateTime.Today;
        x.ProductId = 100;
        x.Quantity = 2000;
        x.BackOrderQuantity = null;
        x.BackOrderPrice = TdDecimal.Null;
            
        // Write out today's orders to the file.
        //
        // Open the file.
        XmlWriterSettings settings = new XmlWriterSettings();
        settings.Indent = true;
        XmlWriter writer = XmlWriter.Create(@"C:\Temp\TodayOrders.XML", settings);
        writer.WriteStartElement("TodayOrders");
  
        // Write out the schema.
        XmlSchemas schemas = new XmlSchemas();
        XmlSchemaExporter schExporter = new XmlSchemaExporter(schemas);
        schExporter.ExportTypeMapping(new XmlReflectionImporter().ImportTypeMapping(typeof(Order)));
        schemas[0].Write(writer);
            
        // Write out the orders.
        XmlSerializer xml = new XmlSerializer(typeof(Order));
        xml.Serialize(writer, x);
              
        // Close the document.
        writer.WriteEndDocument();
        writer.Close();
    }
}
             
/* Output is:
             
<TodayOrders>
  <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Order" nillable="true" type="Order" />
    <xs:complexType name="Order">
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="1" name="Date" type="xs:dateTime" />
        <xs:element minOccurs="1" maxOccurs="1" name="ProductId" type="xs:int" />
        <xs:element minOccurs="1" maxOccurs="1" name="Quantity" type="xs:int" />
        <xs:element minOccurs="1" maxOccurs="1" name="BackOrderQuantity" nillable="true" type="xs:int" />
        <xs:element minOccurs="1" maxOccurs="1" name="BackOrderPrice" nillable="true" type="xs:decimal" />
      </xs:sequence>
    </xs:complexType>
  </xs:schema>
  <Order xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Date>2007-02-01T00:00:00-08:00</Date>
    <ProductId>100</ProductId>
    <Quantity>2000</Quantity>
    <BackOrderQuantity xsi:nil="true" />
    <BackOrderPrice xsi:nil="true" />
  </Order>
</TodayOrders>
             
*/
Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdDecimal Structure
TdDecimal Members