Well, not quiteotherwise only "ui.sri6" would have a value, not "ui.sri1" as the poster claims.
Presuming that the OP omitted the <?xml?> preamble and the document element, the C++ code as I read it says,
Line 23 - get the first child of the document element (which in this case is the entire "XML" fragment in the original post, the outer <studentform> element and the <studentform> children contained within)
Line 25 - set ui.sri1 to the tag name ("studentform"). I guess that didn't look right to the OP, so in the next line
Line 26 - set ui.sri1 to the value of the attribute "studentname". This works, because the current (outer) element has such an attribute.
Line 28 - set ui.sri2 to the tag name. That still doesn't look right I guess, so in the next line
Line 30 - set ui.sri2 to the value of the attribute "address". Since the code is still looking at the outer element, it doesn't have any such attribute, so the returned string is empty.
Lines 32, 34, 36, and 38 - Likewise, no such attributes in the outer element, so the ui.sriN fields are empty.
Lines 41 - 46 - just for fun, if the node is a text node, get the text and then ignore it.
Line 48 - get the next sibling of the current node. Since there is only one top-level <studentform> node, there is no sibling and the loop exits. As I said previously, if there was a sibling, the code would then proceed to overwrite everything from the previous iteration, with the end result that only the final <studentform> sibling's values would appear in the UI.
Bookmarks