Description: Creates an object of the specified module, intended for use when instantiating XML data types from a class factory.
Returns: Object
Usage: Script
Format: MakeTypeInstance(namespace module, type name, parent object, caller object)
Parameters: Namespace Module { Object value } { required } { no default }
The object value of the namespace containing the XML type to be instantiated. If instantiating a normal module this is an object of the parent of that module.
Type Name { text } { required } { no default }
The name of the type or the module to be instantiated.
Parent Object { Object value } { required } { no default }
The object that will become the new object's parent.
Caller Object { Object value } { required } { no default }
The object that will become the new object's caller. If the caller object is slain than the new object will be as well.
Comments: This function is used to build XML trees from schemas loaded by the XML parser. Types built using this DAG from a class factory will retain linkage to their namespaces for translation back into raw XML via "XMLWrite".
An Invalid value is returned if the type is not found. The search for the type is local to the namespace module only.
The parent and caller objects are almost always the same and indicate the parent tag/module in the XML tree where the object is to be placed for purposes of teardown. Putting "Self()" in either of these as per the "Launch" function is usually not desirable.
Example:
Given the following XML schema loaded into a class factory object named "ClassFac":
<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
<s:schema targetNamespace="ExampleNamespaceName"
xmlns:s="http://www.w3.org/2001/XMLSchema">
<s:complexType
name="SampleType">
<s:sequence>
<s:element
maxOccurs="1" minOccurs="1" name="A"
type="s:int"/>
<s:element maxOccurs="1" minOccurs="1"
name="B" type="s:string"/>
<s:element maxOccurs="1"
minOccurs="1" name="C" type="s:long"/>
<s:element
maxOccurs="1" minOccurs="1" name="D"
type="s:string"/>
</s:sequence>
</s:complexType>
</s:schema>
A tag of type "s:SampleType" can be added stored in X as follows:
X = MakeTypeInstance(Scope(ClassFac, "ExampleNamespaceName"),
"SampleType", X, X);
If X is later translated into XML the text below will be created. Note that a prefix needs to be defined for the namespace during the "XMLWrite" call - for this example we will use "prf":
<prf:SampleType>
< prf:A/>
< prf:B/>
< prf:C/>
< prf:D/>
</ prf:SampleType>
See Also:
Dictionary | MetaData | RemWSDL | SetWSDL | XMLProcessor | XMLAddSchema | XMLParse | XMLWrite