SaveXml Method (XDATA)


9.8A

 

The SaveXml method stores the XDATA nodes as a XML formatted string into a file. The method uses the following format:

 

[label]

{object}.SaveXml

[GIVING {return}] using *FileName={filename}[:

 

 

*Options={mask}][,*RootName=]{rootname}

Where:

label
Optional. A Program Execution Label.
object
Required. An XDATA object.
return
Optional. A Numeric Variable that receives a value to signify a pass or fail condition for the method execution.
filename
Required. A Character String Variable or literal that specifies the path and file name used to write the XML data stream.
mask
Optional. A Numeric Variable or decimal number that specifies a bit mask value to control the operations of this method.
rootname
Optional. A Character String Variable or literal that specifies the tag name to be used to output the root name.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The ZERO flag is set if the {return} value is zero.

  2. The OVER flag is set TRUE if the {return} variable is too small where the returned value is truncated.

  3. The EOS flag is always cleared.

  4. The *OPTIONS {mask} values are defined as follows:

  5.  

    Value

    Description

    0x1

    This bit value prevents the output of the XML Processing Instruction declaration at the beginning of the XML data.

    0x2

    This bit value causes XML constructs to use indenting.

    0x4

    This bit value causes the XML lines to output with a terminating <CR>+<LF> end of record sequence.

    0x8

    This bit value causes leading and trailing spaces to be suppressed when outputting the XML data.

    0x10

    This bit value causes double-quote (") and single-quote (') characters to always be escaped when outputting XML element data.

    0x20

    This bit value causes any character less than 0x20 to be converted to 0x20 for the XML data being output.

    0x40

    This bit value causes a tab character to be used to indent XML tags when outputting the XML data.

    0x80

    This bit value causes encoding to be set for ISO8859. This allows 8-bit character values in the XML data being output.

     

  6. The {return} value is a zero if the method execution is successful. Otherwise, a non-zero value is returned to indicate an error has occurred. See the PL/B Runtime Reference under the 'I(I/O) Errors' in the 'XML base handler subcodes' table for details where the {return} value can be defined as follows:.

  7.  

    Value

    Meaning

    0

    XDATA_ERR_NONE (Success)

    5nn

    Where 'nn' is a value found in the 'XML base handler subcodes' found in the PL/B Runtime Reference under the 'I(I/O) Errors' section.

 

 

See Also: XDATA, XDATA Methods, Method Syntax



PL/B Language Reference SaveJson Method (XDATA) StoreJson Method (XDATA)