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

attributes Property

Returns an ISchemaItemCollection object. This collection contains the top-level ISchemaAttribute objects for the XML Schema. The ISchemaAttribute interface is used to further examine the collection of attribute objects.

Example

This example uses attributes from the ISchema.attributes property.

The VBScript example below uses the following XML Schema document.

<?xml version='1.0'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
  <xsd:attribute name='attr1' type='xsd:string' />
  <xsd:attribute name='attr2' type='xsd:date' />
</xsd:schema>

The following is the VBScript example.

Dim oSchemaCache as New XMLSchemaCache
Dim oSchema as ISchema
Dim oAttributes as ISchemaAttribute
Dim nsTarget as String

nsTarget = "http://www.w3.org/2000/09/xmldsig#"
oSchemaCache.add nsTarget, "po.xsd"
Set oSchema = oSchemaCache.getSchema(nsTarget)

For Each oAttribute in oSchema.attributes
   msgbox oAttribute.name
Next

The following VBScript example shows how to list the top-level <attribute> declarations.

Set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.5.0")
oSchemaCache.add "", "po.xsd"
Set oSchema = oSchemaCache.getSchema("")

For Each oAttribute in oSchema.attributes
   WScript.Echo oAttribute.name
Next
[Script]

Implementation Syntax

var oAttributes = oISchema.attributes;

Parameters

None.

Return Values

oAttributes
An object. The collection of top-level <attribute> declarations. This collection contains objects that implement the ISchemaAttribute interface.
[Visual Basic]

Implementation Syntax

Set oAttributes = oISchema.attributes

Parameters

None.

Return Values

oAttributes
An object. The collection of top-level <attribute> declarations. This collection contains objects that implement the ISchemaAttribute interface.
[C/C++]

Implementation Syntax

HRESULT get_attributes (ISchemaItemCollection** attributes);

Parameters

attributes [out,retval]
An object. The collection of top-level <attribute> declarations.

Return Values

S_OK
The value returned if successful.
E_Pointer
The value returned if the attributes collection is NULL.
E_FAIL
The value returned if something else is wrong.

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

ISchemaItemCollection Interface | ISchemaAttribute Interface

Applies to: ISchema Interface