attributes Property (ISchema)
[This feature was only implemented for MSXML 6.0.]
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.
The attributes
property returns just the attributes for a single target namespace. If you want to see all of the attributes for all namespaces, you must query each target namespace separately.
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.6.0")
oSchemaCache.add "", "po.xsd"
Set oSchema = oSchemaCache.getSchema("")
For Each oAttribute in oSchema.attributes
WScript.Echo oAttribute.name
Next
JScript 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 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++ 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.
Versioning
Implemented in: MSXML 6.0