Esempio n. 1
0
XMLNode* XMLNode::FindChild(const char* path)
{
  XMLNode* result = this;
  if (path != NULL && path[0] != '\0')
  {
    MultiString names(path, "/", NULL);
    if (names.word_count() > 0)
    {
      // Go through hierarchy
      int k = 0;
      int m = names.word_count() - 1;
      while (k < m && result != NULL)
      {
        const char* name = names.word(k);
        int i = 0;
        int n = result->ChildCount();
        while (i < n && strcmp(result->Child(i)->Name(), name) != 0)
          ++i; // next child
        if (i < n)
          result = result->Child(i);
        else
          result = NULL; // not found
        ++k; // next level
      }
    }
  }
  return result;
}
Esempio n. 2
0
bool NonRecursiveXMLNodeEnumerator::MoveNext()
{
  if (m_CurrentChild < m_Parent->ChildCount())
    ++m_CurrentChild;
  return m_CurrentChild < m_Parent->ChildCount();
}
Esempio n. 3
0
inline
bool NonRecursiveXMLNodeEnumerator::IsAfterLast()
{
  return m_CurrentChild >= m_Parent->ChildCount();
}