This example reads a more complex file

The input to this example is the following XML file:

xmlExampleMoreComplex.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE home []>
<home colour="white" floors="2">
 This is my house
 <floor level="0">
  Allowed for Everybody
  <room type="other">Entry-hall</room>
  <room type="kitchen" ground="stone"/>
  <room type="living" ground="parquet">Table<sep/>Sofa<sep/>TV</room>
 </floor>
 <floor level="1">
  Only allowed for my Family
  <room type="other">Bathroom</room>
  <bedrooms count="3" colour="creme">
   <room use="parents" beds="1"/>
   <room use="kids" beds="3"/>
   <room use="spare" colour="pine">Computer<sep/>Play-ground</room>
  </bedrooms>
 </floor>
</home>

The code in the example calls the 'fwXml_childNodesContent()' function more than once:

rtn_code = fwXml_childNodesContent ( xml_doc_ident , top_elem_ident , node_names , attributes , nodevalues , exInfo );

One checks the return-code against what one expects, namely that it contains simple element nodes, text nodes, as well as complex element nodes.

if ( fwXml_containsNodeTypes ( rtn_code , ( fwXml_CONTAINS_SIMPLE_ELEMENT_NODES
                                          | fwXml_CONTAINS_TEXT_NODES
										  | fwXml_CONTAINS_COMPLEX_ELEMENT_NODES ) ) )

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:["sibling = 1"]
WCCOAui1:["topelem = [0] 'home'   Attribs 'colour:white | floors:2'"]
WCCOAui1:["rtn_code = 10"]
WCCOAui1:["Text    = [1]    '  This is my house  '"]
WCCOAui1:["TagName = [1]    'floor'   Attribs 'level:0'"]
WCCOAui1:["rtn_code = 10"]
WCCOAui1:["Text    = [2]       '   Allowed for Everybody   '"]
WCCOAui1:["TagName = [2]       'room'   Attribs 'type:other'   Value-of-Child 'Entry-hall'"]
WCCOAui1:["TagName = [2]       'room'   Attribs 'ground:stone | type:kitchen'   Value-of-Child ''"]
WCCOAui1:["TagName = [2]       'room'   Attribs 'ground:parquet | type:living'"]
WCCOAui1:["rtn_code = 8"]
WCCOAui1:["Text    = [3]          'Table'"]
WCCOAui1:["TagName = [3]          'sep'   Attribs ''   Value-of-Child ''"]
WCCOAui1:["Text    = [3]          'Sofa'"]
WCCOAui1:["TagName = [3]          'sep'   Attribs ''   Value-of-Child ''"]
WCCOAui1:["Text    = [3]          'TV'"]
WCCOAui1:["TagName = [1]    'floor'   Attribs 'level:1'"]
WCCOAui1:["rtn_code = 10"]
WCCOAui1:["Text    = [2]       '   Only allowed for my Family   '"]
WCCOAui1:["TagName = [2]       'room'   Attribs 'type:other'   Value-of-Child 'Bathroom'"]
WCCOAui1:["TagName = [2]       'bedrooms'   Attribs 'colour:creme | count:3'"]
WCCOAui1:["rtn_code = 2"]
WCCOAui1:["TagName = [3]          'room'   Attribs 'beds:1 | use:parents'   Value-of-Child ''"]
WCCOAui1:["TagName = [3]          'room'   Attribs 'beds:3 | use:kids'   Value-of-Child ''"]
WCCOAui1:["TagName = [3]          'room'   Attribs 'colour:pine | use:spare'"]
WCCOAui1:["rtn_code = 8"]
WCCOAui1:["Text    = [4]             'Computer'"]
WCCOAui1:["TagName = [4]             'sep'   Attribs ''   Value-of-Child ''"]
WCCOAui1:["Text    = [4]             'Play-ground'"]
WCCOAui1:["rtn_code = 0"]