Name
xte_nodebld_final — Corrects input vector
Synopsis
xte_nodebld_final
(
|
inout arg any , |
in
head
any
) ; |
Description
By default this function reduces all last empty items from the first argument and returns it, but supplied a second argument it also replaces the first item of the first argument by the second argument, but does not commit the return.
Parameters
arg
The vector created by the xte_nodebld_init() and filled by xte_nodebld_acc() function
head
A vector returned by xte_head() function
Errors
Table 24.124. Errors signalled by
xte_nodebld_final
SQLState | Error Code | Error Text | Description |
---|---|---|---|
22003 | SR347 | Too few arguments for xte_nodebld_final | |
22003 | SR348 | The first argument of xte_node_nodebld_final is not made by xte_nodebld_init() function |
Examples
Example 24.491. xte_nodebld_final() with a single argument
Before the xte_nodebld_final() call the length of the vector acc is equal to 16, after the call the length is 3. The vector acc does not correspond to a xml document - there is no a root tag. The result of the xte_nodebld_final() may be used as argument for xte_node_from_nodebld() to get a vector corresponding to complete xml document.
create procedure test1_nodebld() { declare acc any; xte_nodebld_init (acc); xte_nodebld_acc (acc,'string1', string2'); xte_nodebld_acc(acc, 'string3',xte_node(xte_head ('supplier', 'CompanyName','Seller'))); acc:=xte_nodebld_final(acc); . . . }
Example 24.492. xte_nodebld_final() with two arguments.
The vector acc below is corresponding to the following XML element:
<product>string1string2string3
<supplier CompanyName="Seller"></supplier>
</product>
create procedure test2_nodebld() { declare acc any; declare "Res" any; declare "ResLen" integer; result_names ("ResLen", "Res"); xte_nodebld_init (acc); xte_nodebld_acc (acc,'string1', 'string2'); xte_nodebld_acc(acc, 'string3',xte_node(xte_head ('supplier', 'CompanyName','Seller'))); xte_nodebld_final(acc, xte_head('product')); result (length(acc), xml_tree_doc (acc)); } test_nodebld() ResLen Res INTEGER VARCHAR _______________________________________________________________________________ 3 <product>string1string2string3<supplier CompanyName="Seller" /></product>