+ // endElement - callback handler for ending tags in XML.
+ // We use this only for process </group> element endings and
+ // set current_group_id to an immediate parent.
+ // This is required to import group hierarchy correctly.
+ function endElement($parser, $name) {
+ // No need to care about first or second pass, as this is used only in second pass.
+ // See 2nd xml_set_element_handler, where this handler is set.
+ if ($name == 'GROUP') {
+ // Remove self from the parent stack.
+ $self = array_pop($this->parents);
+ // Set current group id to an immediate parent.
+ $len = count($this->parents);
+ $this->current_group_id = $len ? $this->parents[$len-1] : null;
+ }
+ }
+