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



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

Parameters

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

Return Value

Returns a XmlSchemaComplexType that describes a TdPeriodDate.
Example
This examples shows how to use TdPeriodDate with the Xml.Serialization.XmlSerializer class. Xml.Serialization.XmlElementAttribute is used to indicate that the column can be Null.
public class ProductAdvertisement
 {
     public TdDate Date;
            
     public Int32 ProductId;
            
     public Int32? QuantityAvailable;
             
     [XmlElementAttribute(IsNullable = true)]        
     public TdPeriodDate advertisePeriod
            
     public String adPlacement;
 }
             
 internal class ProductAdvertisementWriter
 {
 
     public static void Write()
     {
         // Setup the advertisement
         ProductAdvertisement x = new ProductAdvertisement();
 
         x.Date = new TdDate(DateTime.Today);
         x.ProductId = 100;
         x.QuantityAvailable = 2000;
             
         // Advertisement will last for 7 days from today
         x.AdvertisePeriod = new TdPeriodDate(new TdDate(DateTime.Today), new TdDate(DateTime.Today + new TimeSpan(7, 0, 0, 0)));
         x.adPlacement = "The Newspaper";
            
         // Write out advertisements.
         //
         // Open the file.
         XmlWriterSettings settings = new XmlWriterSettings();
         settings.Indent = true;
         XmlWriter writer = XmlWriter.Create(@"C:\Temp\ProductAdvertisements.XML", settings);
         writer.WriteStartElement("ProductAdvertisements");
   
         // Write out the schema.
         XmlSchemas schemas = new XmlSchemas();
         XmlSchemaExporter schExporter = new XmlSchemaExporter(schemas);
         schExporter.ExportTypeMapping(new XmlReflectionImporter().ImportTypeMapping(typeof(ProductAdvertisement)));
             
         // The schemas must be compiled in order for the schema of the Period type
         // to be written out.
         schemas.Compile(null, false);
             
         schemas[0].Write(writer);
            
         // Write out the advertisement.
         XmlSerializer xml = new XmlSerializer(typeof(ProductAdvertisement));
         xml.Serialize(writer, x);
 
         // Close the document.
         writer.WriteEndDocument();
         writer.Close();
     }
 }
             
/* Output is:
             
2007-02-0110020002007-02-012007-02-08The Newspaper
             
*/
Requirements
ProductVersionsPlatforms
.NET2.1, 3.1, 6Windows, Linux, MacOS
.NET Framework4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8Windows
.NET Standard2.0Windows, Linux, MacOS
See Also

Reference

TdPeriodDate Structure
TdPeriodDate Members