TipcMsgAppendXmlPtr append an XML pointer to a message
T_BOOL TipcMsgAppendXmlPtr(msg
,xml_data
,field_return
) T_IPC_MSGmsg
; T_XMLxml_data
; T_IPC_MSG_FIELD *field_return
;
msg
message to append the field to
xml_data
XML object for new field
field_return
optional location to return field (use NULL
if not needed)
TRUE
if the field was successfully appended to the message, FALSE
otherwise.
If TipcMsgAppendXmlPtr fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcMsgAppendXmlPtr appends an XML object to the end of a message’s data. This function does not make a copy of the string. Instead, the supplied pointer to the string is entered directly into the new message field’s internal data structure. The caller is responsible for making sure that the pointer remains valid for the lifetime of the message field, and for freeing it, if necessary, when the message field has been destroyed. One advantage of TipcMsgAppendXmlPtr over TipcMsgAppendXml is that the string can be modified after the field is appended, but before the message is sent. Another advantage is that the overhead of one copy operation is avoided. The character string is still copied into the connection message buffer when the message is sent.
To update the pointer to point to a new memory location, use the TipcMsgFieldUpdateXmlPtr function.
Caller must ensure that the pointer remains valid until the message is destroyed.
TipcMsgAppendXml, TipcMsgFieldSetSize, TipcMsgFieldUpdateXmlPtr
This example creates a message and appends a pointer to an XML field:
T_IPC_MT mt; T_IPC_MSG msg; T_XML xml; #define USER_MT_XML_TEST 100 mt = TipcMtCreate("xml_test", USER_MT_XML_TEST, "xml"); if (mt == NULL) {return
; /* error */
} msg = TipcMsgCreate(mt); if (mt == NULL) {return
; /* error */
} xml = TutXmlCreate("<data><data1><temp=\"hot\"/></data1></data>"); if (xml == NULL) {return
; /* error */
} if (!TipcMsgAppendXmlPtr(msg, xml, NULL)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |