While working on
MDL-27626 I am facing yet another issue with the order in which the handling methods are called for selected paths in the XML tree (moodle.xml in my case). The problem appears when there is a sub-branch in the middle of a branch and then other sub-branches follow at the end. This pattern is typical for structures like this (real example):
Note that the QUESTION_CATEGORY element has a CONTEXT sub-path within its final elements and then another QUESTIONS sub-path after its final elements. So far, I've been dealing with the sub-path in the middle of final tags by relying on the processing method being called twice, with both halves of the final data being passed separately. That works well, but the order. See how notify_path_start(), notify_path_end() and dispatch_chunk() are called when parsing the structure above:
As you can see, the "QUESTIONS start" and "QUESTIONS/QUESTION start" are triggered before the "QUESTION_CATEGORY process" is dispatched with the second remaining half of the category data (STAMP, PARENT and SORTORDER).
I believe I will be able to hack the question bank conversion code to cope with that. I just want to be sure this is expected behaviour. Or is there a way how the second incarnation of "QUESTION_CATEGORY process" could come before the questions starts?
For now, I'm setting this as a blocker as we must decide and specify the parser's behaviour to rely on.