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_SELECT XmlIdentifierName  XPATHPath NbValues


XPATHPath

AdeliaXPATHPath | <alpha cst> | &<alpha variable>

NbValues

<Numerical variable> | None


Description

Selects the nodes specified by the XPATH path and positions to the first node.


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.


The NbValues variable is optional. If it is specified, it must be a numerical variable into which the number of selected nodes is returned.


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 xmlidf 'ha' 'urn:hardis:warehouse

XML_SELECT xmlidf /ha:bookstore/ha:book

XML_SELECT xmlidf /ha:book[@ha:gender]



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

0 (*NORMAL)

Adelia successfully created the selection and positioned to a node.

100 (*NOT_FOUND)

No node matching the selection was found.

1

Error: invalid XPATH path.

13

Error: XML identifier not open.

25

Error in registering a namespace prefix.


Example

XML_SELECT xml1 /AdelDBG/PgmInfo

XML_GET_VAL xml1 name WNAME


XML_SELECT xml1 /AdelDBG/PgmInfo/Dlls/Dll  WNBVAL

IF WNBVAL > 0

XML_SELECT xml1 /AdelDBG/PgmInfo/Dlls/Dll[WNBVAL]

XML_GET_VAL  xml1 *TEXT  WLAST_DLL

END


* To retrieve prefixed elements

XML_ADD_NS xml1 'ha' 'urn:xmlns:hardis:warehouse'

XML_SELECT xml1 /ha:bookstore/ha:books  WNBVAL

IF WNBVAL > 0

XML_SELECT xml1 /ha:bookstore/ha:books[WNBVAL]

XML_GET_VAL  xml1 *TEXT  TextVar

END




↑ Top of page

  • Aucune étiquette