elements Property
Returns an ISchemaItemCollection object. This collection contains ISchemaElement objects that are top-level items. To find secondary and lower child items, you must use the ISchemaComplexType.contentModel property.
To obtain information about the elements that are returned in the collection, use the ISchemaElement interface. For more information about using elements in an XML Schema, see Declaring Elements in the XML Schema Developer's Guide.
Example
The following is an example of an element declared in an XML Schema.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Software">
<xsd:complexType>
<xsd:all>
<xsd:element name="title" />
<xsd:element name="company" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:schema>
The following VBScript example shows how to list the top-level <element> declarations.
Set oSchemaCache = CreateObject("Msxml2.XMLSchemaCache.5.0")
oSchemaCache.add "", "po.xsd"
Set oSchema = oSchemaCache.getSchema("")
For Each oElement in oSchema.elements
WScript.Echo oElement.name
Next
Implementation Syntax
var oElements = oISchema.elements;
Parameters
None.
Return Values
- oElements
- An object. The collection of top-level
<element>declarations. This collection contains objects that implement theISchemaElementinterface.
Implementation Syntax
Set oElements = oISchema.elements
Parameters
None.
Return Values
- oElements
- An object. The collection of top-level
<element>declarations. This collection contains objects that implement theISchemaElementinterface.
Implementation Syntax
HRESULT get_elements (ISchemaItemCollection** elements);
Parameters
- elements [out,retval]
- An object. The collection of top-level
<element>declarations.
Return Values
- S_OK
- The value returned if successful.
- E_POINTER
- The value returned if the
elementscollection 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
in the upper-left corner of the page.
See Also
ISchemaItemCollection Interface | ISchemaElement Interface
Applies to: ISchema Interface
