isReference Property

MSXML 5.0 SDK

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

isReference Property

Returns a Boolean. If true, the schema element object is a reference to a top-level <element> declaration.

Example

The following example of an XML Schema includes some reference declarations. The VBScript code below the XML Schema retrieves isReference values from the XML Schema.

The following is an XML Schema with reference declarations.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="urn:myschema:all" xmlns:y="urn:myschema:all">
  <xsd:complexType name="CustomerType">
    <xsd:sequence>
      <xsd:element ref="y:Customer"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="Customer"/>
</xsd:schema>

The following is the VBScript example.

Set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.5.0")
nsTarget="urn:myschema:all"
oSchemaCache.add nsTarget, "cx.xml"
Set oSchema = oSchemaCache.getSchema(nsTarget)

' Retrieve the reference to the <element> declaration.
Set oType = oSchema.types.itemByName("CustomerType")
Set oSequence = oType.contentModel
Set oElemRef = oSequence.particles.item(0)
res = oElemRef.name + " isRef:" & oElemRef.isReference & vbNewLine

' Retrieve the original <element> declaration.
Set oElemOrg = oSchema.elements.itemByName(oElemRef.name)
res = res + oElemOrg.name + " isRef:" & oElemOrg.isReference & vbNewLine

WScript.Echo res

The Echo command will show the following results.

Customer isRef:True
Customer isRef:False
[Script]

Implementation Syntax

var bolIsReference = oISchemaElement.isReference;

Parameters

None.

Return Values

bolIsReference
A Boolean. Indicates whether the schema element object is a reference to a top-level <element> declaration.
[Visual Basic]

Implementation Syntax

bolIsReference = oISchemaElement.isReference

Parameters

None.

Return Values

bolIsReference
A Boolean. Indicates whether the schema element object is a reference to a top-level <element> declaration.
[C/C++]

Implementation Syntax

HRESULT get_isReference (VARIANT_BOOL* isReference);

Parameters

isReference [out,retval]
A Boolean. Indicates whether the schema element object is a reference to a top-level <element> declaration.

Return Values

S_OK
The value returned if successful.
E_POINTER
The value returned if the isReference 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

element Element | Declaring Elements

Applies to: ISchemaElement Interface