Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(I/B)

(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(B) (C/S)



Section for use

All.


Syntax

XML_LOAD_LST XmlIdentifierName  XPATHpath <listname> <list field>

or

XML_LOAD_LST XmlIdentifierName  XPATHpath <listname> SeriesVarAttribute


XPATHpath

AdeliaXPATHpath | <AlphaConstant> | &<alpha variable>

SeriesVarAttribute

SeriesVarAttribute, VarAttribute | VarAttribute

VarAttribute

AttributeId <list field>

AttributeId

<attribute name> | &<alpha variable> | *TEXT | *NAME | *PREFNS




Description

Returns the values of the attributes whose nodes match the specified XPATH path in the list.


You can use the *TEXT directive to retrieve the value of the node's text. This directive can be omitted if only the text associated with the node is to be retrieved.


*NAME retrieves the local node's name, in which case the list field will always be an alphanumerical field. The variables relating to the values must be fields in the list.


*PREFNS retrieves the prefix of the node. In this case, the result variable will always be alphanumerical. *PREFNS returns a *BLANK value if the node has not been prefixed.


The XPATH selection path can be specified in the following forms:

  •  as a standard XPATH path as indicated in the alpha constant or alphanumerical variable.


Managing namespaces:

  •  an element can be linked to a namespace provided that it has been prefixed or that it is within range of a default namespace.
  •  an attribute can be linked to a namespace only if it is prefixed.


To query an element or attribute linked to a namespace, you must first add a prefix definition in the current execution context using the XML_ADD_NS instruction. This instruction allows you to associate a prefix to a namespace identified by a URI. The prefix is then used to qualify an element or attribute name in the XPATH path.


Examples:

XML_ADD_NS 'ha' 'urn:hardis:warehouse

XML_LOAD_LST xmlidf /ha:bookstore/ha:book lstbooks ha:author author_col, ha:title title_col, ha:type type_col



When this instruction is executed, the *RETURN_CODE reserved word can take the following values:

0 (*NORMAL)

Operation completed successfully.

100 (*NOT_FOUND)

No node matching the XPATH path was found.

1

Error: invalid XPATH path.

10

One or more of the requested attributes or text does not exist for one or more of the selected nodes. The list field is initialized with the default value for its type. The instruction is executed in the normal way for the other attributes and nodes.

13

Error: XML identifier not open.

-1

Error: type conversion problem involving the retrieved value and the specified variable for one or more text attributes. The list contents are undetermined.

27

Namespace URI not found.



Example

LIST Listtxt  WTEXT

LIST XmlList  Attrib_var1  Attrib_var2  Text_var

...

XML_LOAD_LST  xml1  /ElemRoot/ElemTab  TxtList  WTEXT

XML_LOAD_LST  xml1  /ElemRoot/ElemTab  XmlList  TxtList  attrib1 Attrib_var1, attrib2  Attrib_var2,  *TEXT  Text_var


LIST XmlList  Var_attrib1  Var_attrib2  Var_text

ALPHA(15) AttrName1

ALPHA(15) AttrName2

AttrName1 = 'attrib1'

AttrName2 = 'attrib2'

XML_LOAD_LST  xml1  /ElemRoot/ElemTab  XmlList  &AttrName1 Attrib_var1, &AttrName2  Attrib_var2,  *TEXT  Text_var


* To retrieve the prefixed attributes and prefix of the current node

XML_ADD_NS xml1 'zz' 'urn:xmlns:25hoursaday-com:bookstore'

XML_LOAD_LST xml1 /zz:book/zz:bookstore XmlList zz:attrib1 Attrib_var1, zz:attrib2 Attrib_var2, *PREFNS Text_var




↑ Top of page

  • Aucune étiquette