This example reads an interesting file
The input to this example is the following XML file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE home []> <paragraph> <hr width="80%"/> In the old days, we used <u>underlining</u> for emphasis.<br/> If underlining is no longer a good tool for emphasis, what is?<br clear="all"/> By contrast, <i>italicised</i> words do <b>not</b> draw the (<sup>*</sup>) reader's attention, but <b>bold</b> words do certainly!<br/> Increasing the <font size="+1" color="darkred">font</font> size and colour is another way, but avoid reader dizziness... <center>This is my contribution</center> </paragraph>
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 the return-code against what one expects, namely that it contains simple element nodes as well as text nodes.
if ( fwXml_containsNodeTypes ( rtn_code , ( fwXml_CONTAINS_SIMPLE_ELEMENT_NODES | fwXml_CONTAINS_TEXT_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] 'paragraph' Attribs ''"] WCCOAui1:["rtn_code = 8"] WCCOAui1:["TagName = [1] 'hr' Attribs 'width:80%'"] WCCOAui1:["Text = [1] ' In the old days, we used '"] WCCOAui1:["TagName = [1] 'u' Value-of-Child 'underlining'"] WCCOAui1:["Text = [1] ' for emphasis.'"] WCCOAui1:["TagName = [1] 'br'"] WCCOAui1:["Text = [1] ' If underlining is no longer a good tool for emphasis, what is?'"] WCCOAui1:["TagName = [1] 'br' Attribs 'clear:all'"] WCCOAui1:["Text = [1] ' By contrast, '"] WCCOAui1:["TagName = [1] 'i' Value-of-Child 'italicised'"] WCCOAui1:["Text = [1] ' words do '"] WCCOAui1:["TagName = [1] 'b' Value-of-Child 'not'"] WCCOAui1:["Text = [1] ' draw the ('"] WCCOAui1:["TagName = [1] 'sup' Value-of-Child '*'"] WCCOAui1:["Text = [1] ') reader's attention, but '"] WCCOAui1:["TagName = [1] 'b' Value-of-Child 'bold'"] WCCOAui1:["Text = [1] ' words do certainly!'"] WCCOAui1:["TagName = [1] 'br'"] WCCOAui1:["Text = [1] ' Increasing the '"] WCCOAui1:["TagName = [1] 'font' Attribs 'size:+1 | color:darkred' Value-of-Child 'font'"] WCCOAui1:["Text = [1] ' size and colour is another way, but avoid reader dizziness... '"] WCCOAui1:["TagName = [1] 'center' Value-of-Child 'This is my contribution'"] WCCOAui1:["rtn_code = 0"]