@XMLSerialize
Syntax
@XMLSerialize(XMLD);
@XMLSerialize(XMLD;Options);
Description
This @Function serializes an XML document and returns it as text or as a binary buffer.
The XML document is always output in UTF-8.
The optional Options parameter specifies whether the result is returned as TEXT or VSPECBINBUFFER and whether the XML is formatted or compact.
VSPECHXMLDOC XMLD:
Handle of the XML document to be serialized.
XMLD must contain a valid VSPECHXMLDOC (XMLD) handle.
TEXT Options (Optional):
Specifies the return type and formatting.
The options can be combined.
Option : Meaning
"A" : Returns the serialized XML as TEXT.
"B" : Returns the serialized XML as VSPECBINBUFFER.
"P" : Returns formatted XML ("pretty printed") with indentation.
"C" : Returns compact XML without additional formatting.
If Options is not specified, this corresponds to options AP.
If conflicting options from the same group are specified, the last option takes precedence.
Return Value:
On successful execution, the @Function returns the serialized XML document as TEXT or VSPECBINBUFFER, depending on Options.
When returned as TEXT, the result must not exceed the maximum size of a text item.
When returned as VSPECBINBUFFER, the maximum output size is 2 GB.
If the XML document handle is invalid, Options contains an invalid option, or the XML document cannot be serialized, the @Function returns @ERROR.
Example: @XMLSerialize(XMLD);
Flags := 7;
hXMLD := @XMLCreate(Flags);
hXMLRoot := @XMLCreateRoot(hXMLD;"customer");
XML := @XMLSerialize(hXMLD);
@XMLRelease(hXMLD);
The example serializes the XML document as formatted UTF-8 text.
Example: @XMLSerialize(XMLD;Options);
Flags := 7;
hXMLD := @XMLCreate(Flags);
hXMLRoot := @XMLCreateRoot(hXMLD;"customer");
XMLBuffer := @XMLSerialize(hXMLD;"BC");
@DestroyBuffer(XMLBuffer);
@XMLRelease(hXMLD);
The example serializes the XML document in compact form as a VSPECBINBUFFER.
Note : This text was machine-translated and may contain inaccuracies.
