WebSphere Message Brokers
File: as07865_
Writer: Lorraine Waitt

Reference topic

This build: July 31, 2007 21:37:36

cniCreateElementAsLastChildFromBitstream

Creates a new syntax element tree as the last child of the specified syntax element, and associates it with the specified parser. The new syntax element tree is populated by parsing the specified bit stream. During the execution of this function, the bit stream is copied, so the caller can free or reuse the memory allocated to hold the original bit stream. You can use this function only to create a message body, that is, the last child of the message root. An output message should already exist. The root element of this output message should be passed in as the target element parameter. Because this call is only designed to be used to create a message body, you cannot use it to build successive elements. For example, it should not be used to create an RFH2 as the last child of root and then an XML message as the last child of root, after the RFH2.

Syntax

CciElement* cniCreateElementAsLastChildFromBitstream (
  int*                       returnCode,
  CciElement*                targetElement,
  const struct CciByteArray* value,
  const CciChar*             parserClassName,
  CciChar*                   messageType,
  CciChar*                   messageSet,
  CciChar*                   messageFormat,
  int                        encoding,
  int                        ccsid,
  int                        options);

Parameters

returnCode
The return code from the function (output). Specifying a NULL pointer signifies that the node does not want to deal with errors. If input is not NULL, the output signifies the success status of the call. Any exceptions thrown during the execution of this call are re-thrown to the next upstream node in the flow. Call cciGetLastExceptionData for details of the exception.
Possible return codes are:
  • CCI_SUCCESS
  • CCI_EXCEPTION
  • CCI_INV_ELEMENT_OBJECT
  • CCI_INV_PARSER_NAME
  • CCI_INV_DATA_POINTER
targetElement
The syntax element under which the new syntax element tree is created (input). This must be the message root.
parserClassName
The name of the parser class to use to parse the bit stream (input). You must use the same parser that was used to parse the whole bit stream.
value
A pointer to a CciByteArray struct containing a pointer to the bit stream to be parsed, and also the size in CciBytes of this bit stream (output).
messageType
The message type definition used to create the element tree from the bit stream (input). A NULL pointer means that this parameter is ignored. Also, if the parser specified has no interest in this value, for example if it is a generic XML parser, the parameter is ignored.
messageSet
The message set definition used to create the element tree from the bit stream (input). A NULL pointer means that this parameter is ignored. Also, if the parser specified has no interest in this value, for example if it is a generic XML parser, the parameter is ignored.
messageFormat
The format used to create the element tree from the bit stream (input). A NULL pointer means that this parameter is ignored. Also, if the parser specified has no interest in this value, for example if it is a generic XML parser, the parameter is ignored.
encoding
The encoding to use when parsing the bit stream (input). This parameter is mandatory. You can specify a value of 0 to indicate that the queue manager's encoding should be used.
ccsid
The coded character set identifier to use when parsing the bit stream (input). This parameter is mandatory. You can specify a value of 0 to indicate that the queue manager's ccsid should be used.
options
This is reserved for future use. You must specify a value of 0 to maintain forward compatibility.

Return values

If successful, the address of the new element object is returned. Otherwise, a value zero (CCI_NULL_ADDR) is returned and the return code parameter indicates the reason for the error. If an exception occurs during execution, returnCode is set to CCI_EXCEPTION

Example

  outMQMD = cniCreateElementAsFirstChildUsingParser(&rc,
                                                outRootElement,
                                                CciString("MQHMD",BIP_DEF_COMP_CCSID));
  checkRC(rc);

  cniCopyElementTree(&rc, inMQMD, outMQMD);
  checkRC(rc);
  
  outBlobRoot = cniCreateElementAsLastChildFromBitstream(
                                                   &rc,
                                                   outRootElement,
                                                   &bitstream,
                                                   inParserClassName,
                                                   messageType,
                                                   messageSet,
                                                   messageFormat,
                                                   encoding,
                                                   ccsid,
                                                   0);
    

  
  checkRC(rc);
  ...

  return;
}
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:37:36

as07865_ This topic's URL is: