SaveXMLFile Method


9.0B, PLBCMP GUI Only

 

The SaveXMLFile method stores the contents of a LISTVIEW object into an XML file. The method uses the following format:

 

 

[label]

{object}.SaveXMLFile

[GIVING {return}] USING [*FileName=]{fname}[:

 

 

 

[*Options=]{options}][:

 

 

 

[*TableName=]{tname}][:

 

 

 

[*RowName=]{rname}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A LISTVIEW object that is accessed.

return

Optional. A Numeric Variable that indicates the success or failure of the method.

fname

Required. A Character String Variable or literal that specifies the file name.

options

Optional. A decimal number or Numeric Variable that specifies the load options.

tname

Optional. A Character String Variable or literal that specifies the table name.

rname

Optional. A Character String Variable or literal that specifies the row name.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. If the value returned is zero, the ZERO Condition Flag is set.

  2. A return value of non-zero indicates an error. Values are:

  3.  

    Value

    Meaning ...

    1

    A write operation has already been started

    2

    Unable to create specified XML file

    3

    Unable to open specified XML file

    4

    Unable to create XML parser

    5

    Out of memory

    6

    Attempt to write an attribute on an closed element

    7

    Tag name too long

    8

    Invalid tag name

    9

    XML data too large

    10

    XML file too large for memory area

    11

    File write error

    12

    Internal state error

    13

    No element open

    14

    Internal state error

    15

    Attribute not open

    200

    Unable to send XML file to Application Server

    201

    The ListView has no Columns

    202

    ListView memory allocation error

     

  4. The OVER and EOS Condition Flags are always cleared.

  5. When running under the PL/B Application Server, the first character of the file name has special meaning:

  6.  

    Value

    The file ...

    ! (exclamation mark)

    resides on the client rather than the server.

     

  7. The {options} value is a constant as defined in PLBMETH.INC or a numeric variable indicating one or more of the following option values:

  8.  

    Keyword

    Value

    Meaning ...

    $LV_XMLWR_NOATTR

    0x1

    Do not save the attributes of a row. These attributes are the row image and parameter values.

    $LV_XMLWR_NOCOLS

    0x2

    Do not save the attributes of a column. These attributes are the column width and format value.

    $LV_XMLWR_NOATTRCOLS

    0x4

    Do not save any LISTVIEW columns that contain color or font information.

    $LV_XMLWR_OUTPUTASATTR

    0x8

    Output the column data as XML attributes.

    $LV_XMLWR_OUTPUTSEL

    0x10

    Output only selected rows.

    $LV_XMLWR_OUTPUTCHK

    0x20

    Output only checked rows.

    $LV_XMLWR_OUTPUTALLATTR

    0x40

    Outputs the image index and parameter attributes.

    $LV_CSVWR_NOZEROWIDTH

    0x80

    Prevents the data for an column with a zero width from being output.

    $LV_XMLWR_ISO8859

    0x100

    Enables ISO8859 encoding.

    $LV_XMLWR_OUTPUTHEADER

    0x800

    Output the column header when no rows.

    $LV_XMLWR_NAMEATTR

    0x1000

    Output the column name as attribute.

    $LV_XMLWR_LOWERCASE

    0x200

    Output the data as lowercase.

    $LV_XMLWR_UPPERCASE

    0x400

    Output the data as uppercase.

     

  9. The $LV_XMLWR_NAMEATTR bit definition should be used when the LISTVIEW column names are formatted and contain characters that are invalid for XML tag names.

  10. If not specified, {tname} defaults to 'Table' and {rname} defaults to 'Row'.

  11. A return value of zero (0) indicates success.

  12. This method is supported when using the PL/B Web Server with the LINUX/Linux operating system.

  13. When using LISTVIEW methods that use the Column names for XML output, the Column names must conform to XML Basic requirements. See the XML Basics description for more details. This is the basic description where LISTVIEW Columns are output as XML tag names:

  14.  

    " Tag names are case-sensitive and must start with letters, or an underscore. The rest of the tag name can contain letters, digits, hyphens, underscores, and periods."

     

    When the LISTVIEW Column names contain invalid characters for XML tag names, the $LV_XMLWR_OUTPUTASATTR option should be used where appropriate for the LISTVIEW methods being used.

 

 

See Also: Method Syntax, LISTVIEW Methods

 



PL/B Language Reference SaveCSVFile Method (LISTVIEW) SaveXMLToDim Method (LISTVIEW)