次の方法で共有


elements Property

 

[This feature was only implemented for MSXML 6.0.]

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.

The elements property returns just the elements for a single target namespace. If you want to see all of the elements for all namespaces, you must query each target namespace separately.

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.6.0")
oSchemaCache.add "", "po.xsd"
Set oSchema = oSchemaCache.getSchema("")

For Each oElement in oSchema.elements
   WScript.Echo oElement.name
Next

JScript 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 the ISchemaElement interface.

Visual Basic 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 the ISchemaElement interface.

C/C++ 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 elements collection is NULL.

E_FAIL
The value returned if something else is wrong.

Versioning

Implemented in: MSXML 6.0

Applies to

ISchema Interface

See Also

ISchemaItemCollection Interface
ISchemaElement Interface