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



Teradata.Client.Provider Namespace > TdTimestamp Structure : GetXmlSchema Method
Holds zero or more XML Schema definition language (XSD) schemas.
Specifies the XML Qualified name for TdTimestamp 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 = TdTimestamp.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:dateTime.
Example
This examples shows how to use TdTimestamp with Xml.Serialization.XmlSerializer class. Xml.Serialization.XmlElementAttribute is used to indicate that the Teradata Database column can be Null.
public class Order
{
    public TdTimestamp TimeStamp;
            
    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.Timestamp = new TdTimestamp(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="Timestamp" 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">
    <Timestamp>2007-02-01T00:00:00</Timestamp>
    <ProductId>100</ProductId>
    <Quantity>2000</Quantity>
    <BackOrderQuantity xsi:nil="true" />
    <BackOrderPrice xsi:nil="true" />
  </Order>
</TodayOrders>
             
*/
Requirements

Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2

See Also

Reference

TdTimestamp Structure
TdTimestamp Members