Syntax
char *XML_SaveAsXmlMemory(
XML_HANDLE hXml,
const char *prolog,
bool format,
size_t *output_length,
int *ErrCode
);
Parameters
- hXml
- [in] XML handle
- prolog
- [in] A pointer to the UTF-8 string of the "prolog" for the XML document. Specify NULL if "prolog" is not required.
- format
- [in] Specify true if you want to format the XML document with line breaks and TAB indentation, otherwise specify false.
- output_length
- [out] A pointer to a variable that returns the number of bytes excluding the NUL at the end of the conversion result. Specify NULL when the number of bytes is not required.
- ErrCode
- [out] A pointer to a variable that returns an error code. Specify NULL when no error code is required.
Return value
Returns a pointer to the buffer that stores the conversion result if the conversion is successful, NULL otherwise.Remarks
Converts the contents of the XML object specified by hXml to a UTF-8 XML document, outputs it to a buffer, and returns a pointer to the buffer.
If you specify a UTF-8 string in prolog , the specified string is output at the beginning of the buffer. It is used to output XML declaration etc.
If this function returns a value other than NULL, you need to free the buffer with the free() function.
If the function fails, it returns NULL and ErrCode returns the following error code:
Error code | Description |
---|---|
XML_INVALID_PARAMETER_ERROR | Parameter error |
XML_MEMORY_ALLOCATION_ERROR | Memory allocation error |
XML_INVALID_XML_OBJECT_ERROR | Invalid XML handle |
Requirements
Header file:
XML.hLibrary file:
CodeConversion.h : ver. 1.1.1 or later.
libXML.a
libCodeConversion.a : ver.1.1.1 or later
libSTARTUPOPH5000.a
Sample
XML_SaveAsXmlMemory(hXml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", true, &length, &ErrCode);
See also
Last updated: 2021/10/21