maxOccurs Property

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - 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. If MaxOccurs returns 0, the schema item should not appear. If maxOccurs returns UNBOUNDED(-1), the number of appearances of the schema item is unlimited.

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