Variant c_SimpleXMLElementIterator::t_next() {
  if (m_iter1 == nullptr) return uninit_null();
  if (m_parent->m_is_attribute) {
    m_iter1->next();
    return uninit_null();
  }

  if (m_iter2) {
    m_iter2->next();
    if (!m_iter2->end()) {
      return uninit_null();
    }
    delete m_iter2; m_iter2 = nullptr;
  }
  m_iter1->next();
  while (!m_iter1->end()) {
    if (m_iter1->second().isArray()) {
      m_iter2 = new ArrayIter(m_iter1->second().toArray());
      break;
    }
    if (m_iter1->second().isObject()) {
      break;
    }
    m_iter1->next();
  }
  return uninit_null();
}
Variant c_SimpleXMLElementIterator::t_next() {
  if (m_iter1 == nullptr) return uninit_null();
  if (m_parent->m_is_attribute) {
    m_iter1->next();
    return uninit_null();
  }

  if (m_iter2) {
    m_iter2->next();
    if (!m_iter2->end()) {
      return uninit_null();
    }
    delete m_iter2; m_iter2 = nullptr;
  }
  m_iter1->next();
  while (!m_iter1->end()) {
    if (m_iter1->second().isArray()) {
      m_iter2 = new ArrayIter(m_iter1->second().toArray());
      break;
    }
    if (m_iter1->second().isObject()) {
      break;
    }
    m_iter1->next();
  }
  return uninit_null();
}