types Property
Returns an ISchemaItemCollection
object. This collection contains top-level <simpleType>
and <complexType>
declarations of the XML Schema. The ISchemaType.itemType
property determines whether the object is of the type complex or simple.
Example
This VBScript example shows type information being extracted from an XML Schema document.
The following is the XML Schema used in the example.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" finalDefault="restriction"> <xsd:element name="item"> <xsd:complexType> <xsd:sequence> <xsd:element name="productName" type="xsd:string"/> <xsd:element name="quantity"> <xsd:simpleType> <xsd:restriction base="xsd:positiveInteger"> <xsd:maxExclusive value="100"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="USPrice" type="xsd:decimal"/> <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/> </xsd:sequence> <xsd:attribute name="partNum" type="xsd:int" use="required"/> </xsd:complexType> </xsd:element> </xsd:schema>
The following is the VBScript example.
Dim oSchemaCache as New XMLSchemaCache50 Dim oSchema as ISchema Dim oType as ISchemaType Dim nsTarget as String Dim strText as String nsTarget = "http://www.w3.org/2000/09/xmldsig#" oSchemaCache.add nsTarget, "po.xsd" Set oSchema = oSchemaCache.getSchema(nsTarget) For Each oType in oSchema.types strText = oType.name & " is a " If oType.itemType = SOMITEM_ANYTYPE Then strText = strText & "built-in complex any type" End If If oType.itemType = SOMITEM_SIMPLETYPE Then strText = strText & "simple type" End If If oType.itemType = SOMITEM_COMPLEXTYPE Then strText = strText & "complex type" End If If (oType.itemType and SOMITEM_DATATYPE) = SOMITEM_DATATYPE Then strText = strText & "built-in type" End If Next msgbox strText
[Script]
Implementation Syntax
var oTypes = oISchema.types;
Parameters
None.
Return Values
- oTypes
- An object. The collection of named simple-type and complex-type objects defined in the XML Schema. This collection contains objects that implement the
ISchemaType
interface and theISchemaComplexType
interface.
[Visual Basic]
Implementation Syntax
Set oTypes = oISchema.types
Parameters
None.
Return Values
- oTypes
- An object. The collection of named simple-type and complex-type objects defined in the XML Schema. This collection contains objects that implement the
ISchemaType
interface and theISchemaComplexType
interface.
[C/C++]
Implementation Syntax
HRESULT get_types (ISchemaItemCollection** types);
Parameters
- types [out,retval]
- An object. The collection of named simple-type and complex-type objects defined in the XML Schema. This collection contains objects that implement the
ISchemaType
interface or theISchemaComplexType
interface. UseISchemaType::isComplexType
to query for the correct interface.
Return Values
- S_OK
- The value returned if successful.
- E_POINTER
- The value returned if the
types
object is Null. - E_FAIL
- The value returned if something else is wrong.
To view reference information for Visual Basic or C/C++ only, click the Language Filter button in the upper-left corner of the page.
See Also
ISchemaItemCollection Interface | ISchemaType Interface | ISchemaComplexType Interface | ISchemaItem itemType Property
Applies to: ISchema Interface