Logo Search packages:      
Sourcecode: katalog version File versions  Download package

QDomNode Katalog::findNode ( QStringList &  path  )  const [protected]

Find node relative to path

Definition at line 385 of file katalog.cpp.

References m_rootElement.

Referenced by addItems(), del(), findEntry(), getNodeContent(), readInfo(), rename(), and sourceURL().

{
  // Search logic:
  // path[0] <---> it is the catalog, find corresponding node walking through children of root node
  // no more path? ==> return node
  // path[1] <---> find corresponding node walking through children of previously find node
  // no more path? ==> return node
  // ...
  
  QStringList::Iterator it;
  
  QDomNode node = m_rootElement;
  
  for(it = path.begin(); it != path.end(); it++ )
  {
    node = node.firstChild();
    // find the correct children, if not found node.isNull() == true
    while ( !node.isNull())
    {
      if ( (node.nodeName() == CATALOG || node.nodeName() == ITEM ) &&
           node.isElement() &&
           node.toElement().attribute( "name" ).compare( *it ) == 0)
        break;
      // nothing this run try another
      node = node.nextSibling();
    }
    if(node.isNull())
    {
      // path item not found, useless to continue :-(
      node = QDomNode();
      break;
    }
  }
  
  return node;
}


Generated by  Doxygen 1.6.0   Back to index