minOccurs Property1

 

[This feature was only implemented for MSXML 4.0.]

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>

JScript 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.

If oParticle.minOccurs <> 1 Then 
            res = res + " minOccurs='" & oParticle.minOccurs & "'"
        End If

Visual Basic 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++ 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.

Versioning

Implemented in: MSXML 6.0

Applies to

ISchemaParticle Interface

See Also

maxOccurs Property1
element Element