project BLF > class XML > method ReadXML
Description
This method reads a XML-file and puts the nodes, attributes and values in the output temp-table. If you supply the starting node name it will only read the nodes that have this name and its child nodes.
Parameters
icXMLFile | input | character | Filename of the XMLfile that will be used to fill the output temp-table. |
icStartTag | input | character | Starting node name. If this parameter has a value, reading the nodes into the output temp-table will start from the node which name equals this starting node name. It will also read its child nodes. |
tNodes | output | temp-table | Output temp-table. This table contains the info of the XMLfile. If the type is 'A', it means that is was an attribute, 'N' mains node. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
QadFinancials
program code (program1/xml.p)
empty temp-table tNodes.
CREATE X-DOCUMENT vhDoc in widget-pool "non-persistent".
/*load the file into the handle*/
vhDoc:LOAD("File", icXMLFile, no) NO-ERROR.
If Error-status:Error
Then Do:
Assign oiReturnStatus = -1.
Delete Object vhDoc.
Return.
End.
Assign vicounter = 1.
/*set the tag*/
Assign vcTag = Trim(icStartTag).
If vcTag = ?
Then Assign vcTag = ''.
<M-1 run ReadXmlSub
(input vhDoc (ihParent),
input 0 (iiNodeParentId),
output viFcReturnSuper (oiReturnStatus)) in XML>
If viFcReturnSuper <> 0
Then Assign oiReturnStatus = viFcReturnSuper.
If viFcReturnSuper < 0
Then Do:
Delete Object vhDoc.
Return.
End.
Delete Object vhDoc.