Previous in Contents Next in Contents

AddElement Method

The AddElement method first creates an instance of the Dictionary class and sets the new object's "tag" and "content" keys to the strings passed as parameters to the method. It then adds the object to the corresponding Elements collection and returns the IDispatch interface of the added object.

This method is provided by many of the Push classes to allow the addition of special XML elements that are not represented by the objects directly.

VBScript Syntax

IObject.AddElement  tag [, content]

Parameters

tag (VT_BSTR)

A string specifying the name of the tag.

content (VT_BSTR)

The optional string specifying the content enclosed by the tag.

Return Value

The IDictionary dispinterface on the Dictionary object added to the collection (VT_DISPATCH).

Remarks

See the reference section on the Elements collection for a complete discussion on defining custom XML elements.

Example

VBScript and Windows Scripting Host

CodebaseObject.AddElement "NEWELEMENT", "VALUE"

See Also

The Elements Collection

Defining a Custom XML Element


© 1997-2000 Microsoft Corporation. All rights reserved.