Partager via


substitutionGroup Property

 

[This feature was only implemented for MSXML 6.0.]

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>  

JScript Syntax

var oSubstitutionGroup = oISchemaAttribute.substitutionGroup;  

Parameters

None.

Return Values

oSubstitutionGroup
An object. The top-level ISchemaElement object.

Visual Basic Syntax

Set oSubstitutionGroup = oISchemaAttribute.substitutionGroup  

Parameters

None.

Return Values

oSubstitutionGroup
An object. The top-level ISchemaElement object.

C/C++ 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.

Versioning

Implemented in: MSXML 6.0

Applies to

ISchemaElement Interface