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

use Property

Returns an integer that corresponds to a value from the declared constant SCHEMAUSE values. The use property indicates the type of validation restrictions that are on an attribute. The <attribute> declaration includes the use attribute.

When the value returned for the use property is SCHEMAUSE_PROHIBITED, the value of the ISchemaItem.itemType property of the attribute is SOMITEM_DATATYPE_ANYTYPE. The following table shows the values returned and their descriptions.

SCHEMAUSE value Description
SCHEMAUSE_OPTIONAL Attribute is not required to be in the document.
SCHEMAUSE_PROHIBITED Attribute cannot be in the document.
SCHEMAUSE_REQUIRED Attribute is required to be in the document.

Example

The following is an example of the use attribute in an XML Schema.

<schema>
   <element name="someelement">
      <attribute name="someattribute" use="prohibited"/>
      <attribute name="newattribute" use="required"/>
  </element>
</schema>
[Script]

Implementation Syntax

var conUse = oISchemaAttribute.use;

Parameters

None.

Return Values

conUse
A constant. The use style for the attribute.
[Visual Basic]

Implementation Syntax

conUse = oISchemaAttribute.use

Parameters

None.

Return Values

conUse
A constant. The use style for the attribute.
[C/C++]

Implementation Syntax

HRESULT get_use(SCHEMAUSE* use);

Parameters

use [out,retval]
An object. The use style for the attribute. The following values are possible.

SCHEMAUSE_OPTIONAL

SCHEMAUSE_PROHIBITED

SCHEMAUSE_REQUIRED

Return Values

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

attribute Element

Applies to: ISchemaAttribute Interface