use Property
[This feature was only implemented for MSXML 6.0.]
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. |
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>
JScript Syntax
var conUse = oISchemaAttribute.use;
Parameters
None.
Return Values
conUse
A constant. The use style for the attribute.
Example
The following snippets are taken from the Walk the SOM sample application. In this snippet, the use
property is retrieved from the ISchemaAttribute
object.
If oAttr.use = SCHEMAUSE_OPTIONAL Then printAttr = printAttr + " use='optional'"
If oAttr.use = SCHEMAUSE_PROHIBITED Then printAttr = printAttr + " use='prohibited'"
If oAttr.use = SCHEMAUSE_REQUIRED Then printAttr = printAttr + " use='required'"
Visual Basic Syntax
conUse = oISchemaAttribute.use
Parameters
None.
Return Values
conUse
A constant. The use style for the attribute.
C/C++ 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.
Versioning
Implemented in: MSXML 6.0