substitutionGroup Property

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SOM Reference

substitutionGroup Property

Returns a top-level ISchemaElement object. This object is the <element> declaration that the substitutionGroup attribute of the current object refers to. The substitution group provides an option for the declaration of an element. For example, if you have the following two elements, <A name='eleA' /> and <B name='eleB' substitutionGroup ="eleA"/>, you could use the <B> element anywhere in the instance document where the <A> element was expected. This might work well in a <sequence> declaration.

Example

The following example shows an XML Schema document and the instance documents that would be valid for its declaration.

<xsd:schema xmlns:xsd= 'http://www.w3.org/2001/XMLSchema'>
  <xsd:element name='eleA' type='xsd:string' />
  <xsd:element name='eleB' substitutionGroup='eleA' />
  <xsd:element name='eleSeq'>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref='eleA' />
        <xsd:element ref='eleB' />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

This instance document would validate:

<eleSeq>
  <eleA>a string</eleA>
  <eleB>another string</eleB>
</eleSeq>

This instance documents would also validate:

<eleSeq>
  <eleB>a string</eleB>
  <eleB>another string</eleB>
</eleSeq>
[Script]

Implementation Syntax

var oSubstitutionGroup = oISchemaAttribute.substitutionGroup;

Parameters

None.

Return Values

oSubstitutionGroup
An object. The top-level ISchemaElement object.
[Visual Basic]

Implementation Syntax

Set oSubstitutionGroup = oISchemaAttribute.substitutionGroup

Parameters

None.

Return Values

oSubstitutionGroup
An object. The top-level ISchemaElement object.
[C/C++]

Implementation Syntax

HRESULT get_substitutionGroup(ISchemaElement** substitutionGroup);

Parameters

substitutionGroup [out,retval]
An object. The ISchemaElement object.

Return Values

S_OK
The value returned if successful.
E_POINTER
The value returned if the substitutionGroup parameter is NULL.
E_FAIL
The value returned if something else is wrong.

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

Applies to: ISchemaElement Interface