<component> Element
Encloses an entire Windows Script Component definition.
<component id=componentid>
script component information here
</component>
Values
componentid
A string that uniquely identifies the script component. This value is useful if a document contains multiple script components or when you are generating one type library for several script components. Identifiers must begin with a letter and can contain no spaces. The identifier must be unique within a script component package.If specified, this value functions as the class name for the script component in the host application. For example, if you specify the component ID "MyComponent" in the <component> element, the script component is identified as the class MyComponent in the Visual Basic object browser. If no component ID is specified, the default value is ComponentCoClass.
Remarks
In script component files, an entire script component definition — including<registration>, <public> and <implements> elements — must appear inside a <component> element. If the file contains multiple script components, they must in turn be enclosed within a <package> element.
Example
The following shows a simple but complete script component that includes a factorial method and a name property.
Note
A CDATA section is required to make the script in the <script> element opaque. For details, see Script Component Files and XML Conformance.
<?XML version="1.0"?>
<component>
<registration>
description="My Test Component"
progid="Component.TestScript"
version="1"
classid="{2154c700-9253-11d1-a3ac-0aa0044eb5f}"
</registration>
<public>
<property name="name"/>
<method name="factorial"/>
</public>
<script language="VBScript">
<![CDATA[
Function factorial(n)
If isNumeric(n) Then
If n <= 1 Then
factorial = 1
Else
factorial = n*factorial(n-1)
End If
Else
factorial = -2 ' Error code.
End If
End Function
]]>
</script>
</component>