GetBuiltInSimpleType Method (XmlQualifiedName)

XmlSchemaType.GetBuiltInSimpleType Method (XmlQualifiedName)


Returns an XmlSchemaSimpleType that represents the built-in simple type of the simple type that is specified by the qualified name.

Namespace:   System.Xml.Schema
Assembly:  System.Xml (in System.Xml.dll)

public static XmlSchemaSimpleType GetBuiltInSimpleType(
	XmlQualifiedName qualifiedName


Type: System.Xml.XmlQualifiedName

The XmlQualifiedName of the simple type.

Return Value

Type: System.Xml.Schema.XmlSchemaSimpleType

The XmlSchemaSimpleType that represents the built-in simple type.

Exception Condition

The XmlQualifiedName parameter is null.

You cannot directly serialize the built-in type. If you need to serialize the type, create a new simple type which derives from the built-in type and serialize the simple type.

The following example shows how to create the type and add it to the schema.

using System;
using System.Xml;
using System.Xml.Schema;

namespace GetBuiltInSimpleType
    class Program
        static void Main(string[] args)
            XmlSchema schema = new XmlSchema();
            XmlSchemaSimpleType stringType = new XmlSchemaSimpleType();
            stringType.Name = "myString";
            XmlSchemaSimpleTypeRestriction stringRestriction = 
                                 new XmlSchemaSimpleTypeRestriction();
            stringRestriction.BaseTypeName = 
                                 new XmlQualifiedName("string",
            stringType.Content = stringRestriction;

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft