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



Teradata.Client.Provider Namespace > TdIntervalDayToSecond Structure : GetXmlSchema Method
Holds zero or more XML Schema definition language (XSD) schemas.
Gets the XML Qualified name for TdIntervalDayToSecond 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 = TdIntervalDayToSecond.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:duration.
Example
This example shows how to use the TdIntervalDayToSecond with Xml.Serialization.XmlSerializer class. Xml.Serialization.XmlElementAttribute is used to indicate that the column can be Null.
public class Order
{
    public TdTimestamp Date;
             
    public TdIntervalDayToSecond ExpirationPeriod;
             
    public TdTimestamp ExpirationDate;
            
    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 = new TdTimestamp(DateTime.Today);
        // 5 days 4 hours 30 minutes 0 seconds and 0 fractional seconds
        x.ExpirationPeriod = new TdIntervalDayToSecond(5, 4, 30, 0, 0);
        x.ExpirationDate = x.Date + x.ExpirationPeriod;
        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="ExpirationPeriod" type="xs:duration" />
        <xs:element minOccurs="1" maxOccurs="1" name="ExpirationDate" 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>2008-02-01T00:00:00-08:00</Date>
    <ExpirationPeriod>P5DT4H30M</ExpirationPeriod>
    <ExpirationDate>2008-02-06T04:30:00-08:00</ExpirationDate>
    <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

TdIntervalDayToSecond Structure
TdIntervalDayToSecond Members