Mega Code Archive

 
Categories / VB.Net / XML
 

XmlSchemaFractionDigitsFacet Class sets a restriction for the fraction value of a simpleType element

Imports System Imports System.Xml Imports System.Xml.Schema Class XMLSchemaExamples     Public Shared Sub Main()         Dim schema As New XmlSchema()         Dim RatingType As New XmlSchemaSimpleType()         RatingType.Name = "RatingType"         Dim restriction As New XmlSchemaSimpleTypeRestriction()         restriction.BaseTypeName = New XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema")         Dim totalDigits As New XmlSchemaTotalDigitsFacet()         totalDigits.Value = "2"         restriction.Facets.Add(totalDigits)         Dim fractionDigits As New XmlSchemaFractionDigitsFacet()         fractionDigits.Value = "1"         restriction.Facets.Add(fractionDigits)         RatingType.Content = restriction         schema.Items.Add(RatingType)         Dim element As New XmlSchemaElement()         element.Name = "movie"         Dim complexType As New XmlSchemaComplexType()         Dim ratingAttribute As New XmlSchemaAttribute()         ratingAttribute.Name = "rating"         ratingAttribute.SchemaTypeName = New XmlQualifiedName("RatingType", "")         complexType.Attributes.Add(ratingAttribute)         element.SchemaType = complexType         schema.Items.Add(element)     End Sub End Class