Ejemplo 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)
        {
          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;
}
Ejemplo n.º 2
0
bool NonRecursiveXmlNodeEnumerator::MoveNext()
{
  if (m_CurrentChild < m_Parent->ChildCount())
    ++m_CurrentChild;
  return m_CurrentChild < m_Parent->ChildCount();
}
Ejemplo n.º 3
0
inline
bool NonRecursiveXmlNodeEnumerator::IsAfterLast()
{
  return m_CurrentChild >= m_Parent->ChildCount();
}