Share via


types Property

 

[This feature was only implemented for MSXML 6.0.]

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.

The types property returns just the types for a single target namespace. If you want to see all of the types for all namespaces, you must query each target namespace separately.

Example

This VB 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 VB example.

Dim oSchemaCache as New XMLSchemaCache60
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

JScript 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 the ISchemaComplexType interface.

Visual Basic 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 the ISchemaComplexType interface.

C/C++ 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 the ISchemaComplexType interface. Use ISchemaType::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.

Versioning

Implemented in: MSXML 6.0

Applies to

ISchema Interface

See Also

ISchemaItemCollection Interface
ISchemaType Interface
ISchemaComplexType Interface
itemType Property1