This example reads a flat listing
The input to this example is the following XML file:
<room type="Computer-Room"> <location>CH-1211 Geneva 23 <organisation>CERN <identification ref="513-R-050"/> <emergency phone="74444"/> <dimensions x="100m" y="80m" h="270cm"/> <air>18 degrees Celcius <air>65% relative humidity <air>20 millibars above outside pressure <equipment type="PC" quantity="8000">Quatro-Core 4GHz CPUs <equipment type="Network">Twenty 1-Gbps Connections <equipment type="Storage">Two Tape Storages of 20TBytes </room>
The code in the example only calls ONCE the 'fwXml_childNodesContent()' function:
rtn_code = fwXml_childNodesContent ( xml_doc_ident , top_elem_ident , node_names , attributes , nodevalues , exInfo );
One checks if the return-code is effectively '0' because that means that the child-nodes are all element-nodes that contain at most one text-node as their child. The following is returned via the three output-parameters:
The program then prints out the returned information in the three dynamic variables in the following form:
WCCOAui1:["document = 0"] WCCOAui1:["1-child = 0"] WCCOAui1:["topelem = room"] WCCOAui1:["rtn_code = 0"] WCCOAui1:["TagName = 'location' - Attribs = '' - Value-of-Child = 'CH-1211 Geneva 23'"] WCCOAui1:["TagName = 'organisation' - Attribs = '' - Value-of-Child = 'CERN'"] WCCOAui1:["TagName = 'identification' - Attribs = 'ref:513-R-050' - Value-of-Child = ''"] WCCOAui1:["TagName = 'emergency' - Attribs = 'phone:74444' - Value-of-Child = ''"] WCCOAui1:["TagName = 'dimensions' - Attribs = 'y:80m | x:100m | h:270cm' - Value-of-Child = ''"] WCCOAui1:["TagName = 'air' - Attribs = '' - Value-of-Child = '18 degrees Celcius'"] WCCOAui1:["TagName = 'air' - Attribs = '' - Value-of-Child = '65% relative humidity'"] WCCOAui1:["TagName = 'air' - Attribs = '' - Value-of-Child = '20 millibars above outside pressure'"] WCCOAui1:["TagName = 'equipment' - Attribs = 'quantity:8000 | type:PC' - Value-of-Child = 'Quatro-Core 4GHz CPUs'"] WCCOAui1:["TagName = 'equipment' - Attribs = 'type:Network' - Value-of-Child = 'Twenty 1-Gbps Connections'"] WCCOAui1:["TagName = 'equipment' - Attribs = 'type:Storage' - Value-of-Child = 'Two Tape Storages of 20TBytes'"] WCCOAui1:["rtn_code = 0"]