Microsoft XML Core Services (MSXML) 4.0 - SOM Reference

maxOccurs Property

Returns a variant of type VT_BSTR that indicates the maximum number of times an item can occur in the current context of a document.

Example

The following is an example of the maxOccurs attribute used in a 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 varMaxOccurs = oISchemaParticle.maxOccurs;

Parameters

None.

Return Values

varMaxOccurs
A variant. The maximum number of times this item can appear in an instance document of this XML Schema document. If the maxOccurs property is unbounded (-1), there is no limit to the number of occurrences.

Example

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

        If oParticle.maxOccurs <> 1 Then 
            If oParticle.maxOccurs = -1 Then 
                res = res + " maxOccurs='unbounded'"
            Else
                res = res + " maxOccurs='" & oParticle.maxOccurs & "'"
            End If
[Visual Basic]

Implementation Syntax

varMaxOccurs = oISchemaParticle.maxOccurs

Parameters

None.

Return Values

varMaxOccurs
A variant. The maximum number of times this item can appear in an instance document of this XML Schema document. If the maxOccurs property is unbounded (-1), there is no limit to the number of occurrences.
[C/C++]

Implementation Syntax

HRESULT get_maxOccurs(VARIANT* maxOccurs);

Parameters

maxOccurs [out,retval]
A variant. The maximum number of times this item can occur in an instance document of this XML Schema document.

Return Values

S_OK
The value returned if successful.
E_POINTER
The value returned if the maxOccurs 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 minOccurs Property | element Element

Applies to: ISchemaParticle Interface

This HTML Help has been published using the chm2web software.