ISerializerFactoryConfig2::LocalTypeMapping Method

HRESULT LocalTypeMapping([in] BSTR ParentXmlType, [in] BSTR ParentXmlTypeNS, [in] BSTR ChildName, [in] BSTR ChildNamespace, [in] BSTR Type, [in] BSTR TypeNamespace);

Registers a new local element type mapping. This is the mapping from an element name to an Xml Type, however it is scoped by the containing type. This allows you to have multiple elements with the same name, but for them to have different types depending upon the type of the element they are contained within.

 

Parameters

ParentXmlType
BSTR, [in]: The XmlType of the containing element type
ParentXmlTypeNS
BSTR, [in]: The namespace of the containing element type
ChildName
BSTR, [in]: The element name to register a type for
ChildNamespace
BSTR, [in]: The namespace of the element name to register a type for
Type
BSTR, [in]: The XmlType of the element
TypeNamespace
BSTR, [in]: The namespace of the XmlType of the element

 

Return Values

 

Sample Code

set e = CreateObject("pocketSOAP.Envelope.2")
const XSD = "http://www.w3.org/2001/XMLSchema"
e.SerializerFactory.LocalTypeMapping "one",  "http://soapinterop.org/", "item", "", "string", XSD
e.SerializerFactory.LocalTypeMapping "two",  "http://soapinterop.org/", "item", "", "int",    XSD
e.SerializerFactory.LocalTypeMapping "three","http://soapinterop.org/", "item", "", "float",  XSD

e.parse GetTestMsg

for i = 0 to e.parameters.count-1
	set n = e.parameters.item(i).Nodes.item(0)
	wscript.echo n.Name & " -> " & n.Value & " -> " & TypeName(n.Value)
next

Function GetTestMsg()
	m = "<S:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' " + _
		 "SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:E='http://schemas.xmlsoap.org/soap/encoding/' " + _
		 "xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' " + _
		 "xmlns:d='http://soapinterop.org/' " + _
		 "xmlns:xs='http://www.w3.org/2001/XMLSchema' " + _
		 "xmlns:xi='http://www.w3.org/2001/XMLSchema-instance'>" + _
		 "<S:Body><d:testFooResponse>" + _
		 "<a xi:type='d:one'><item>String</item></a>" + _
		 "<b xi:type='d:two'><item>1414</item></b>" + _
		 "<c xi:type='d:three'><item>33.33</item></c>" + _ 
		 "</d:testFooResponse></S:Body></S:Envelope>"
	GetTestMsg = m
end Function

' generates
item -> Text -> String
item -> 1414 -> Long
item -> 33.33 -> Single

 

See Also

The ISerializerFactoryConfig2 Interface | 

 

 

Copyright

Copyright © Simon Fell, 2000-2004. All rights reserved.