LoadXMLFile Method


9.0B, PLBCMP GUI Only

 

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

 

 

[label]

{object}.LoadXMLFile

[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 or the XML data stream to be loaded directly.

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. The {*FileName} parameter allows either the file name of an XML file or an XML data stream as extracted from an XFILE. The XML data stream may be retrieved using the GETFILE XMLDATA.

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

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

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

  5.  

    Value

    The file ...

    ! (exclamation mark)

    resides on the client rather than the server.

    ? (question mark)

    should be either obtained from the cache or from the server and placed in the cache.

    * (asterisk)

    should be either obtained from the in-memory cache or from the server and placed only in the in-memory cache.

     

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

  7.  

    Keyword

    Value

    Meaning ...

    $LV_XMLRD_IGNORE_ATTR

    0x1

    Ignore attributes when loading a file. If not used, attributes are treated as columns.

    $LV_XMLRD_NO_CONV

    0x2

    Do not convert an underscore in an element name to blanks.

    $LV_XMLRD_USECOLUMNS

    0x4

    Use the column names existing in the LISTVIEW. If not used, column names are obtained from the XML file.

    $LV_XMLWR_ISO8859

    0x100

    Enables ISO8859 encoding.

     

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

  9. A return value of zero (0) indicates success. Failures return one of the values described as follows:

  10.  

    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.

    16

    Error detected parsing XML data file.

    200

    Unable to retrieve XML file from Application Server.

    201

    The ListView has no columns or there is insufficient memory to process columns.

     

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

 

 

See Also: Method Syntax, LISTVIEW Methods

 



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