当前位置: 首页>>代码示例>>C++>>正文


C++ QDomNode::firstChildElement方法代码示例

本文整理汇总了C++中QDomNode::firstChildElement方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomNode::firstChildElement方法的具体用法?C++ QDomNode::firstChildElement怎么用?C++ QDomNode::firstChildElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDomNode的用法示例。


在下文中一共展示了QDomNode::firstChildElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseXml

void AcquisitionData::parseXml(QDomNode& dataNode)
{
	QDomNode recordsessionsNode = dataNode.namedItem("recordSessions");
	QDomElement recodesessionNode = recordsessionsNode.firstChildElement("recordSession");
	for (; !recodesessionNode.isNull(); recodesessionNode = recodesessionNode.nextSiblingElement("recordSession"))
	{
//		RecordSessionPtr session(new RecordSession("", 0,0,""));
		RecordSessionPtr session(new RecordSession());
		session->parseXml(recodesessionNode);
		this->addRecordSession(session);
	}
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例2: parsePluginNode

void PluginDialog::parsePluginNode(QDomNode node)
{
    QString name = node.firstChildElement("name").text();
    QString shortname = node.firstChildElement("shortname").text();
    QString iconUrl = node.firstChildElement("icon").text();
    QString category = node.firstChildElement("category").text();
    QString downloadUrl = node.firstChildElement("download").text();
    QString version = node.firstChildElement("version").text();
    QIcon icon = NetworkUtils::getIconFromUrl(QUrl(iconUrl));

    QList<QStandardItem *> rowItems;
    QStandardItem* pluginItem = new QStandardItem(icon, name);
    pluginItem->setData(shortname, Qt::UserRole);
    pluginItem->setData(downloadUrl, Qt::UserRole + 1);
    pluginItem->setData(version, Qt::UserRole + 2);
    rowItems << pluginItem;
    QStandardItem* enableItem = new QStandardItem("");
    enableItem->setCheckable(true);
    if(pluginManager->isInstalled(shortname))
    {
        enableItem->setCheckState(Qt::Checked);
    }
    rowItems << enableItem;
    if(category != "local")
    {
        categoryOnline->appendRow(rowItems);
    }else
    {
        categoryLocal->appendRow(rowItems);
    }
}
开发者ID:Nothing4You,项目名称:screencloud,代码行数:31,代码来源:plugindialog.cpp

示例3: callDone

void XMLParser::callDone()
{
    QNetworkReply* reply = qobject_cast<QNetworkReply*>(this->sender());

    if(!reply)
        return;

    QDomDocument doc;
    doc.setContent(reply->readAll());

    QDomElement docRootElement = doc.documentElement();

    QDomNode n = docRootElement.firstChild();

    for(QDomNode n = docRootElement.firstChild(); !n.isNull(); n= n.nextSibling())
    {
        qDebug() << n.firstChildElement("text").text();
        d->tweetList.prepend(n.firstChildElement("text").text());
    }

   // qDebug() << d->tweetList;
}
开发者ID:srish,项目名称:QtQuickTwitterFeeds,代码行数:22,代码来源:XMLParser.cpp

示例4: QRectF

void
StationsPluginFactorySimple::loadCity(const QDomNode & city)
{
  QDomNode node;
  QPointF min, max;
  QDomNamedNodeMap attrs;
  StationsPluginSimplePrivate data;

  attrs = city.attributes();

  data.id = attrs.namedItem("id").nodeValue();

  node = city.firstChildElement("latitude");
  attrs = node.attributes();

  data.center.setX(node.toElement().text().toDouble());
  min.setX(attrs.namedItem("min").nodeValue().toDouble());
  max.setX(attrs.namedItem("max").nodeValue().toDouble());

  node = city.firstChildElement("longitude");
  attrs = node.attributes();

  data.center.setY(node.toElement().text().toDouble());
  min.setY(attrs.namedItem("min").nodeValue().toDouble());
  max.setY(attrs.namedItem("max").nodeValue().toDouble());

  data.rect = QRectF(min, max);
  data.statusUrl = city.firstChildElement("status").text();
  data.infosUrl = city.firstChildElement("infos").text();
  data.name = city.firstChildElement("name").text();
  data.bikeName = city.firstChildElement("bikeName").text();
  data.type = city.firstChildElement("type").text();

  QString icon = city.firstChildElement("bikeIcon").text();

  if (icon.isEmpty())
    icon = ":/res/bike.png";

  data.bikeIcon = QIcon(icon);

  if (data.id.isEmpty() || !data.rect.isValid() || data.center.isNull() ||
      data.name.isEmpty() || data.bikeName.isEmpty() || data.type.isEmpty()) {
    qWarning() << "Error processing city " << data.id
	       << data.name << data.bikeName << data.type;
    return ;
  }

  cities[data.id] = data;
}
开发者ID:iksaif,项目名称:lugdulov,代码行数:49,代码来源:stationspluginfactorysimple.cpp

示例5: file

void
StationsPluginFactorySimple::loadInfos(const QString & xml)
{
  QFile file(xml);
  QDomDocument doc;
  QDomNode node;
  QDomNamedNodeMap attrs;

  if (!file.open(QIODevice::ReadOnly)) {
    qWarning() << "Can't open" << file.fileName() << ": " << file.error();
    return ;
  }

  doc.setContent(&file);
  node = doc.firstChildElement("country");
  attrs = node.attributes();

  id_ =  attrs.namedItem("id").nodeValue();
  name_ = node.firstChildElement("name").text();
  description_ = node.firstChildElement("description").text();
  icon_ = QIcon(node.firstChildElement("icon").text());
}
开发者ID:iksaif,项目名称:lugdulov,代码行数:22,代码来源:stationspluginfactorysimple.cpp

示例6: populateEpisodesFromChannelXML

bool PodcastRSSParser::populateEpisodesFromChannelXML(QList<PodcastEpisode *> *episodes, QByteArray xmlReply)
{
    qDebug() << "Parsing XML for episodes";

    if (xmlReply.size() < 10) {
        return false;
    }

    QDomDocument xmlDocument;
    if (xmlDocument.setContent(xmlReply) == false) {        // Construct the XML document and parse it.
        return false;
    }

    QDomElement docElement = xmlDocument.documentElement();

    QDomNodeList channelNodes = docElement.elementsByTagName("item");  // Find all the "item nodes from the feed XML.
    qDebug() << "I have" << channelNodes.size() << "episode elements";

    for (uint i=0; i<channelNodes.length(); i++) {
        QDomNode node = channelNodes.at(i);

        if (isEmptyItem(node)) {
            qWarning() << "Empty podcast item. Ignoring...";
            continue;
        }

        PodcastEpisode *episode = new PodcastEpisode;
        QDateTime pubDate = parsePubDate(node);

        if (!pubDate.isValid()) {
            qWarning() << "Could not parse pubDate for podcast episode!";
            delete episode;
            continue;
        } else {
            episode->setPubTime(pubDate);
        }

        episode->setTitle(node.firstChildElement("title").text());
        episode->setDescription(node.firstChildElement("description").text());

        if (episode->description().isEmpty())
            episode->setDescription(node.firstChildElement("content:encoded").text());

        if (episode->description().isEmpty())
            episode->setDescription(node.firstChildElement("itunes:summary").text());


        episode->setDuration(node.firstChildElement("itunes:duration").text());

        QDomNamedNodeMap attrMap = node.firstChildElement("enclosure").attributes();
        episode->setDownloadLink(attrMap.namedItem("url").toAttr().value());
        episode->setDownloadSize(attrMap.namedItem("length").toAttr().value().toInt());

        episodes->append(episode);
    }

    return true;
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例7: listAllPhotos

void PicasaModel::listAllPhotos(KJob *job)
{
    QDomDocument document;
    document.setContent(m_datas[static_cast<KIO::Job*>(job)]);

    QDomNodeList entries = document.elementsByTagName("entry");
    m_expandable = false;
    m_photos.clear();
    for (int i = 0; i < entries.count(); i++) {

        QString id = entries.at(i).namedItem("id").toElement().text().split('/').last();
        QString published = entries.at(i).namedItem("published").toElement().text();
        QString updated = entries.at(i).namedItem("updated").toElement().text();
        QString title = entries.at(i).namedItem("title").toElement().text();
        QDomElement contentElement = entries.at(i).firstChildElement("content");
        QString link = contentElement.attribute("src");
        QString albumid = entries.at(i).namedItem("gphoto:albumid").toElement().text();
        QString width = entries.at(i).namedItem("gphoto:width").toElement().text();
        QString height = entries.at(i).namedItem("gphoto:height").toElement().text();
        QString size = entries.at(i).namedItem("gphoto:size").toElement().text();

        QDomNode mediaNode = entries.at(i).namedItem("media:group");
        QDomElement mediaElement = mediaNode.firstChildElement("media:thumbnail");
        QString thumb72 = mediaElement.attribute("url");
        mediaElement = mediaElement.nextSiblingElement("media:thumbnail");
        QString thumb144 = mediaElement.attribute("url");
        mediaElement = mediaElement.nextSiblingElement("media:thumbnail");
        QString thumb288 = mediaElement.attribute("url");

        Photo photo;
        photo.published = published;
        photo.updated = updated;
        photo.title = title;
        photo.link = link;
        photo.albumId = albumid;
        photo.width = width;
        photo.height = height;
        photo.size = size;

        photo.thumbnail72 = thumb72;
        photo.thumbnail144 = thumb144;
        photo.thumbnail288 = thumb288;

        m_photos.append(photo);
    }
    m_queries.remove(static_cast<KIO::Job*>(job));
    m_datas.remove(static_cast<KIO::Job*>(job));
    reset();

}
开发者ID:akshayratan,项目名称:plasmamediacenter,代码行数:50,代码来源:picasamodel.cpp

示例8: queryDB

//API for query datebase, return a DOM tree's pointer.
bool queryDB(const QString &dep, const QString &arr, const QDate &date, QDomElement* &elem){
	QDomDocument doc;
	QFile file("Resources\\" + date.toString("yyyy-MM-dd") + ".xml");
	if(!file.open(QFile::ReadOnly))return false;
	if(!doc.setContent(&file))return false;
	QDomNode root = doc.documentElement();
	QDomElement ret;
	//search for the goal flights , create a DOM subtree in heap and return its pointer as a parameter
	for(ret = root.firstChildElement(); ret.attribute("name") != dep; ret = ret.nextSiblingElement());
	for(ret = ret.firstChildElement(); ret.attribute("name") != arr; ret = ret.nextSiblingElement());
	if(ret.isNull())return false;
	elem = new QDomElement(ret);
	file.close();
	return true;
}
开发者ID:YvesChan,项目名称:csAir,代码行数:16,代码来源:operateDB.cpp

示例9: url

QList< QPair < Mirrors::Mask, QUrl > >
Mirrors::parseMirrors(const QDomNode & node)
{
  QList< QPair < Mirrors::Mask, QUrl > > list;

  QDomElement p = node.firstChildElement("Mirror");
  while (!p.isNull()) {
    QUrl url(p.firstChildElement("mirrorpath").text());
    Mirrors::Mask mask = (Mirrors::Mask) p.firstChildElement("typemask").text().toUInt();

    list.append(QPair < Mirrors::Mask, QUrl >(mask, url));

    p = p.nextSiblingElement("Mirror");
  }
  return list;
}
开发者ID:jepaan,项目名称:qttvdb,代码行数:16,代码来源:mirrors.cpp

示例10: readXml

bool QgsMeshLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &context )
{
  QgsDebugMsgLevel( QStringLiteral( "Datasource in QgsMeshLayer::readXml: %1" ).arg( mDataSource.toLocal8Bit().data() ), 3 );

  //process provider key
  QDomNode pkeyNode = layer_node.namedItem( QStringLiteral( "provider" ) );

  if ( pkeyNode.isNull() )
  {
    mProviderKey.clear();
  }
  else
  {
    QDomElement pkeyElt = pkeyNode.toElement();
    mProviderKey = pkeyElt.text();
  }

  QgsDataProvider::ProviderOptions providerOptions;
  if ( !setDataProvider( mProviderKey, providerOptions ) )
  {
    return false;
  }

  QDomElement elemExtraDatasets = layer_node.firstChildElement( QStringLiteral( "extra-datasets" ) );
  if ( !elemExtraDatasets.isNull() )
  {
    QDomElement elemUri = elemExtraDatasets.firstChildElement( QStringLiteral( "uri" ) );
    while ( !elemUri.isNull() )
    {
      QString uri = context.pathResolver().readPath( elemUri.text() );

      bool res = mDataProvider->addDataset( uri );
#ifdef QGISDEBUG
      QgsDebugMsg( QStringLiteral( "extra dataset (res %1): %2" ).arg( res ).arg( uri ) );
#else
      ( void )res; // avoid unused warning in release builds
#endif

      elemUri = elemUri.nextSiblingElement( QStringLiteral( "uri" ) );
    }
  }

  QString errorMsg;
  readSymbology( layer_node, errorMsg, context );

  return mValid; // should be true if read successfully
}
开发者ID:anitagraser,项目名称:QGIS,代码行数:47,代码来源:qgsmeshlayer.cpp

示例11: findSiblingName

QDomNode XmlFloTransBase::findSiblingName(QDomNode &node,QString &name)
{
    if(name.isEmpty())
        return QDomNode();

    QDomNode parent = node.parentNode();
    QDomNode itnode = parent.firstChild();

    while(!itnode.isNull())
    {
        if(itnode.firstChildElement(XmlEleTagName).text() == name)
            return itnode;
        itnode = itnode.nextSibling();
    }

    return itnode;
}
开发者ID:xjoof,项目名称:flowchart,代码行数:17,代码来源:xmlflochatransfer.cpp

示例12: loaduserinfo

void loader::loaduserinfo(QDomNode infos, account* newaccount){
    useraccount* temp=dynamic_cast<useraccount*>(newaccount);
    QString name=infos.firstChildElement(QString("name")).text(),
    surname=infos.firstChildElement(QString("surname")).text(),
    daybirth=infos.firstChildElement(QString("daybirth")).text(),
    monthbirth=infos.firstChildElement(QString("monthbirth")).text(),
    yearbirth=infos.firstChildElement(QString("yearbirth")).text(),
    birthplace=infos.firstChildElement(QString("birthplace")).text(),
    telnum=infos.firstChildElement(QString("telnum")).text(),
    email=infos.firstChildElement(QString("email")).text();
    userinfo* infotemp=new userinfo();
    if(!name.isEmpty()) infotemp->setName(name);
    if(!surname.isEmpty()) infotemp->setSurname(surname);
    if(!daybirth.isEmpty()&&!monthbirth.isEmpty()&&!yearbirth.isEmpty()) infotemp->setDate(QDate(yearbirth.toInt(), monthbirth.toInt(), daybirth.toInt()));
    if(!birthplace.isEmpty()) infotemp->setPlace(birthplace);
    if(!telnum.isEmpty()) infotemp->setNumber(telnum);
    if(!email.isEmpty()) infotemp->setEmail(email);
    temp->setinfo(*infotemp);
}
开发者ID:aramilialon,项目名称:Progetto-Legami,代码行数:19,代码来源:loader.cpp

示例13: handleRdfXml

void FeedFetcher::handleRdfXml(QDomNode node) {
	QList<Tweet*> tweets;
	QDomNodeList children = node.childNodes();
	QDateTime startDate = QDateTime::currentDateTime();
	for (int x=0;x<children.count();x++) {
		QDomNode item = children.at(x);
//			QMessageBox::information(0,"Bleugh",item.nodeName());
		if (nodeName(item)=="channel") {
			QDomNode title = item.firstChildElement("title");
			if (!title.isNull())
				emit feedTitle(title.firstChild().nodeValue());
		} else if (nodeName(item)=="item") {
			FeedItem *tweet = new FeedItem();
			tweet->created_at=startDate.addSecs(-x);
			tweet->feed_item_date="";//tweet->created_at.toString();
			tweet->sourceUrl=url;
			QDomNodeList children2 = item.childNodes();
			for (int y=0;y<children2.count();y++) {
				QDomNode childItem = children2.at(y);
				if (nodeName(childItem)=="title") {
					tweet->message=childItem.firstChild().nodeValue();
				} else if (nodeName(childItem)=="guid") {
					tweet->id=childItem.firstChild().nodeValue();
				} else if (nodeName(childItem)=="description") {
					tweet->content=childItem.firstChild().nodeValue();
				} else if (nodeName(childItem)=="link") {
					tweet->url=childItem.firstChild().nodeValue();
					if (tweet->id=="")
						tweet->id=tweet->url;
				} else if (nodeName(childItem)=="pubDate") {
					//Thu Feb 19 00:20:20 +0000 2009
					QString date = childItem.firstChild().nodeValue();
//					tweet->feed_item_date = childItem.firstChild().nodeValue().left(26);
//						QString hour = dateStr.mid(20,5);
//						dateStr=dateStr.left(20)+dateStr.right(4);
//					tweet->created_at=QDateTime::fromString(dateStr,"ddd MMM dd HH:mm:ss +0000 yyyy");
					// Sat, 05 Sep 2009 14:51:00 GMT
					tweet->created_at=parseRdfDate(date.left(25));
				}
			}
			tweets.append(tweet);
		}
	}
	emit haveTweets(tweets);
}
开发者ID:mrrooster,项目名称:Yasst,代码行数:45,代码来源:FeedFetcher.cpp

示例14: SearchGivenNodeTo

QString XmlRelationCheckerCoreImpl::SearchGivenNodeTo(QDomNode nodeToCheck, const QString& key, XmlRelation* xmlRelation,
                                                   const QString& parentNumberBase, int number) const
{
    if(!nodeToCheck.isNull())
    {
        if(nodeToCheck.isElement() && !nodeToCheck.isComment())
        {
            //Initialize the identifiersNumber string with the base number
            QString identifierNumber = parentNumberBase;

            //If it's not empty is because it's the first node and it needn't the dot seprator
            if(!parentNumberBase.isEmpty())
            {
                identifierNumber.append('.');
            }

            //Attach the number
            identifierNumber.append(QString::number(number));

            //Controll if the node is a node to key
            const QString& nodeToKey = CheckIsNodeTo(nodeToCheck, xmlRelation);

            //Check this is the wanted node to
            if(key.compare(nodeToKey, Qt::CaseInsensitive) == 0)
            {
                return identifierNumber;
            }
            //Check the son
            else
            {
                const QString& sonIdentifier = SearchGivenNodeTo(nodeToCheck.firstChildElement(), key, xmlRelation, identifierNumber, 1);

                //If the son is the node searched
                if( ! sonIdentifier.isEmpty())
                {
                    //return the child identifier number
                    return sonIdentifier;
                }
            }
        }
        //Recursive call on the sibling
        return SearchGivenNodeTo(nodeToCheck.nextSiblingElement(), key, xmlRelation, parentNumberBase, number+1);
    }
    return "";
}
开发者ID:Mauxx91,项目名称:XML-Editor,代码行数:45,代码来源:XmlRelationCheckerCoreImpl.cpp

示例15: read_automation_path

void AutomationPathSerializer::read_automation_path(const QDomNode &node, AutomationPath &path)
{
	auto point = node.firstChildElement();
	while (! point.isNull()) {
		if (point.tagName() == "point") {
			bool hasX = false;
			bool hasY = false;
			float x = point.attribute("x").toFloat(&hasX);
			float y = point.attribute("y").toFloat(&hasY);

			if (hasX && hasY) {
				path.add_point(x, y);
			}

		}
		point = point.nextSiblingElement();
	}
}
开发者ID:blablack,项目名称:hydrogen,代码行数:18,代码来源:automation_path_serializer.cpp


注:本文中的QDomNode::firstChildElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。