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


icXMLFileinputcharacterFilename of the XMLfile that will be used to fill the output temp-table.
icStartTaginputcharacterStarting 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.
tNodesoutputtemp-tableOutput 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.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BEventDaemonProcessor.PerformWorkItem
method BEventDestination.ValidateComponent
method ComponentPool.LoadSettings
method Mail.IPAdressGetter
method other.MainBlock
method Progress.MainBlock
method XML.ReadXMLNodeValue

QadFinancials
method MfgNotification.MainBlock


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.