This example reads a more complex file
The input to this example is the following XML file:
<?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 );
The return-code in this example is '10' because the child-nodes are text-nodes mixed with
element-nodes that contain more than one child or not a text-node, thus the returned value is
[1< The program then prints out the returned information in the three dynamic variables in the following form:
if the key 'fwXml_CHILDNODESTYPE' is present then one has to do with a text-node or an element-node!
In case of a text-node, 'nodevalues' returns the value (character-data) of the text-node.
In case of an element-node, the key 'fwXml_CHILDSUBTREEID' will also be present that identifies the 'top_elem_ident'
to be used in the next call to the function 'fwXml_childNodesContent()'.
In case of an element-node with one text-node child, 'nodevalues' returns the value (character-data) of the contained
text-node if present, otherwise it returns the empty string.
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"]