Encloses an entire Windows Script Component definition.
<component id=componentid> script component information here </component>
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.
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.
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>