ISerializerOutput::Attribute Method

HRESULT Attribute([in] BSTR Name, [in] BSTR Namespace, [in] BSTR value);

Writes an attribute and value to the stream. A prefix will be generated for the namespace as required.



BSTR, [in]: The attribute name
BSTR, [in]: The namespace for the attribute name, the serializer engine will automatically map a prefix to this URI for you
BSTR, [in]: The attribute value


Return Values


Sample Code

Visual Basic Class File

Implements ISoapSerializer

Private Const NS = ""

Private Sub ISoapSerializer_Serialize(  Val As Variant, _
                                        ByVal ctx As PocketSOAP.ISerializerContext, _
                                        ByVal dest As PocketSOAP.ISerializerOutput)
    Dim a As AuthInfo
    Set a = Val

    dest.Attribute "Type", NS, a.authType
    dest.WriteText a.authKey
End Sub

This inserts x:Type='authType'>AuthKey into the stream, note that the serialization engine adds the containing element info, so the total results xml would be
<h:Auth x:Type='authType'>AuthKey</h:Auth>


See Also

The ISerializerOutput Interface | 




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