Share via


isReference Property (ISchemaElement)

 

[This feature was only implemented for MSXML 6.0.]

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

JScript 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 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++ 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.

Versioning

Implemented in: MSXML 6.0

Applies to

ISchemaElement Interface

See Also

element Element
Declaring Elements