Microsoft XML Core Services (MSXML) 4.0 - SOM Reference

minOccurs Property

Returns a variant of type VT_BSTR that represents the minimum number of times that an item can occur in a document. A value of zero indicates that the item is optional.

Example

The following is an example of the minOccurs attribute used in an XML Schema.

<schema xmlns="http://www.w3.org/2001/XMLSchema">
   <complexType name="someelement">
      <choice>
         <element name="book" minOccurs="1" maxOccurs="4"/>
         <element name="magazine" minOccurs="1" maxOccurs="1"/>
      </choice>
   </complexType>
</schema>
[Script]

Implementation Syntax

var varMinOccurs = oISchemaParticle.minOccurs;

Parameters

None.

Return Values

varMinOccurs
A variant. The minimum number of times the item can appear in an instance document of this XML Schema document. Zero is returned if the item is optional.

Example

The following snippet is taken from the Walk the SOM sample application. In this snippet, the minOccurs property is retrieved from the ISchemaParticle object. To see the snippet in the application code, click here.

        If oParticle.minOccurs <> 1 Then 
            res = res + " minOccurs='" & oParticle.minOccurs & "'"
        End If
[Visual Basic]

Implementation Syntax

varMinOccurs = oISchemaParticle.minOccurs

Parameters

None.

Return Values

varMinOccurs
A variant. The minimum number of times the item can appear in an instance document of this XML Schema document. Zero is returned if the item is optional.
[C/C++]

Implementation Syntax

HRESULT get_minOccurs(VARIANT* minOccurs);

Parameters

minOccurs [out,retval]
A variant. The minimum number of times the item can appear in an instance document of this XML Schema document. Zero is returned if the item is optional.

Return Values

S_OK
The value returned if successful.
E_POINTER
The value returned if the minOccurs parameter is NULL.

To view reference information for Visual Basic or C/C++ only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

ISchemaParticle maxOccurs Property | element Element

Applies to: ISchemaParticle Interface

This HTML Help has been published using the chm2web software.