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


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

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


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

示例1: parseAtom

void NewsSite::parseAtom(QDomDocument domDoc)
{
    QDomNodeList entries = domDoc.elementsByTagName("entry");

    for (unsigned int i = 0; i < (unsigned) entries.count(); i++)
    {
        QDomNode itemNode = entries.item(i);
        QString title =  ReplaceHtmlChar(itemNode.namedItem("title").toElement()
                                         .text().simplified());

        QDomNode summNode = itemNode.namedItem("summary");
        QString description = QString::null;
        if (!summNode.isNull())
        {
            description = ReplaceHtmlChar(
                summNode.toElement().text().simplified());
        }

        QDomNode linkNode = itemNode.namedItem("link");
        QString url = QString::null;
        if (!linkNode.isNull())
        {
            QDomAttr linkHref = linkNode.toElement().attributeNode("href");
            if (!linkHref.isNull())
                url = linkHref.value();
        }

        insertNewsArticle(NewsArticle(title, description, url));
    }
}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:30,代码来源:newssite.cpp

示例2: addDeviceServices

// Recursively add all devices and embedded devices to the deviceServices_ map
void RootService::addDeviceServices(const QDomNode &device)
{
	qDebug() << "UPnP discovered device " << XmlFunctions::getNodeValue(device, "/UDN") << endl;

	if(XmlFunctions::getNodeValue(device, "/deviceType") == InternetGatewayDeviceType)
	{
		QString description;
		description = XmlFunctions::getNodeValue(device, "/friendlyName");
		if(description.isNull())
			description = XmlFunctions::getNodeValue(device, "/modelDescription");
		if(description.isNull())
			description = XmlFunctions::getNodeValue(device, "/modelName") + " " + XmlFunctions::getNodeValue(device, "/modelNumber");
		if(description.isNull())
			description = __tr2qs("Unknown");

		qDebug() << "Model: " << description << endl;

		g_pApp->activeConsole()->output(KVI_OUT_GENERICSTATUS,__tr2qs_ctx("[UPNP]: found gateway device: %s","upnp"), description.toUtf8().data());


	}
	// Insert the given device node
	// The "key" is the device/UDN tag, the value is a list of device/serviceList/service nodes
	m_deviceServices.insert(XmlFunctions::getNodeValue(device, "/UDN"),
				device.namedItem("serviceList").childNodes());

	// Find all embedded device nodes
	QDomNodeList embeddedDevices = device.namedItem("deviceList").childNodes();
	for(int i = 0; i < embeddedDevices.count(); i++)
	{
		if(embeddedDevices.item(i).nodeName() != "device") continue;
		addDeviceServices(embeddedDevices.item(i));
	}
}
开发者ID:DINKIN,项目名称:KVIrc,代码行数:35,代码来源:RootService.cpp

示例3: readXml

void QgsMapSettings::readXml( QDomNode &node )
{
  // set destination CRS
  QgsCoordinateReferenceSystem srs;
  QDomNode srsNode = node.namedItem( QStringLiteral( "destinationsrs" ) );
  if ( !srsNode.isNull() )
  {
    srs.readXml( srsNode );
  }
  setDestinationCrs( srs );

  // set extent
  QDomNode extentNode = node.namedItem( QStringLiteral( "extent" ) );
  QgsRectangle aoi = QgsXmlUtils::readRectangle( extentNode.toElement() );
  setExtent( aoi );

  // set rotation
  QDomNode rotationNode = node.namedItem( QStringLiteral( "rotation" ) );
  QString rotationVal = rotationNode.toElement().text();
  if ( ! rotationVal.isEmpty() )
  {
    double rot = rotationVal.toDouble();
    setRotation( rot );
  }

  //render map tile
  QDomElement renderMapTileElem = node.firstChildElement( QStringLiteral( "rendermaptile" ) );
  if ( !renderMapTileElem.isNull() )
  {
    setFlag( QgsMapSettings::RenderMapTile, renderMapTileElem.text() == QLatin1String( "1" ) );
  }
}
开发者ID:manisandro,项目名称:QGIS,代码行数:32,代码来源:qgsmapsettings.cpp

示例4: loadBundleData

bool BasicmLearningEditor::loadBundleData(const QString &bundle_data) {
  QDomDocument bundle_document;
  bundle_document.setContent(bundle_data);

  QDomNodeList items = bundle_document.documentElement().elementsByTagName("item");

  for (int i = 0; i < items.size(); i++) {
    QDomNode item = items.at(i);

    if (item.isElement()) {
      QString title = item.namedItem("item_title").toElement().text();
      QString description = item.namedItem("item_description").toElement().text();

      if (title.isEmpty() || description.isEmpty()) {
        // TODO: error
        continue;
      }
      else {
        addNewItem(title, description);
      }
    }
    else {
      continue;
    }
  }

  // Load author & name.
  m_ui->m_txtAuthor->lineEdit()->setText(bundle_document.documentElement().namedItem("author").namedItem("name").toElement().text());
  m_ui->m_txtName->lineEdit()->setText(bundle_document.documentElement().namedItem("title").toElement().text());

  return true;
}
开发者ID:Arulini,项目名称:BuildmLearn-Toolkit,代码行数:32,代码来源:basicmlearningeditor.cpp

示例5: readSymbolMeta

static QgsOldSymbolMeta readSymbolMeta( const QDomNode& synode )
{
  QgsOldSymbolMeta meta;

  QDomNode lvalnode = synode.namedItem( "lowervalue" );
  if ( ! lvalnode.isNull() )
  {
    QDomElement lvalelement = lvalnode.toElement();
    if ( lvalelement.attribute( "null" ).toInt() == 1 )
    {
      meta.lowerValue = QString::null;
    }
    else
    {
      meta.lowerValue = lvalelement.text();
    }
  }

  QDomNode uvalnode = synode.namedItem( "uppervalue" );
  if ( ! uvalnode.isNull() )
  {
    QDomElement uvalelement = uvalnode.toElement();
    meta.upperValue = uvalelement.text();
  }

  QDomNode labelnode = synode.namedItem( "label" );
  if ( ! labelnode.isNull() )
  {
    QDomElement labelelement = labelnode.toElement();
    meta.label = labelelement.text();
  }

  return meta;
}
开发者ID:V17nika,项目名称:QGIS,代码行数:34,代码来源:qgssymbologyconversion.cpp

示例6: getNode

// Helper function, get a specific node
QDomNode XmlFunctions::getNode( const QDomNode &rootNode, const QString &path )
{

  QStringList pathItems = path.split( "/", QString::SkipEmptyParts );
  QDomNode    childNode = rootNode.namedItem( pathItems[0] );  // can be a null node

  int i = 1;
  while( i < pathItems.count() )
  {
    if( childNode.isNull() )
    {
      break;
    }

    childNode = childNode.namedItem( pathItems[ i ] );
    i++;  // not using for loop so i is always correct for kdDebug() below.
  }

  if( childNode.isNull() ) {
      qDebug() << "XmlFunctions::getNode() - Notice: node '" << pathItems[ i - 1 ] << "'"
                << " does not exist (root=" << rootNode.nodeName() << " path=" << path << ")." << endl;
  }

  return childNode;
}
开发者ID:DINKIN,项目名称:KVIrc,代码行数:26,代码来源:XmlFunctions.cpp

示例7: writeTextNode

bool KOfficePlugin::writeTextNode(QDomDocument & doc,
				  QDomNode & parentNode,
				  const QString  &nodeName,
				  const QString  &value) const
{
  if (parentNode.toElement().isNull()){
    kdDebug(7034) << "Parent node is Null or not an Element, cannot write node "
		  << nodeName << endl;
    return false;
  }

  // If the node does not exist, we create it...
  if (parentNode.namedItem(nodeName).isNull())
    QDomNode ex = parentNode.appendChild(doc.createElement(nodeName));

  // Now, we are sure we have a node
  QDomElement nodeA = parentNode.namedItem(nodeName).toElement();

  // Ooops... existing node were not of the good type...
  if (nodeA.isNull()){
    kdDebug(7034) << "Wrong type of node " << nodeName << ", should be Element"
		  << endl;
    return false;
  }

  QDomText txtNode = doc.createTextNode(value);

  // If the node has already Text Child, we replace it.
  if (nodeA.firstChild().isNull())
    nodeA.appendChild(txtNode);
  else
    nodeA.replaceChild( txtNode, nodeA.firstChild());
  return true;
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例8: readXML

int QgsUniqueValueRenderer::readXML( const QDomNode& rnode, QgsVectorLayer& vl )
{
  mGeometryType = vl.geometryType();
  QDomNode classnode = rnode.namedItem( "classificationfield" );
  QString classificationField = classnode.toElement().text();

  QgsVectorDataProvider* theProvider = vl.dataProvider();
  if ( !theProvider )
  {
    return 1;
  }

  int classificationId = vl.fieldNameIndex( classificationField );
  if ( classificationId == -1 )
  {
    //go on. Because with joins, it might be the joined layer is not loaded yet
  }
  setClassificationField( classificationId );

  QDomNode symbolnode = rnode.namedItem( "symbol" );
  while ( !symbolnode.isNull() )
  {
    QgsSymbol* msy = new QgsSymbol( mGeometryType );
    msy->readXML( symbolnode, &vl );
    insertValue( msy->lowerValue(), msy );
    symbolnode = symbolnode.nextSibling();
  }
  updateSymbolAttributes();
  vl.setRenderer( this );
  return 0;
}
开发者ID:L-Infantini,项目名称:Quantum-GIS,代码行数:31,代码来源:qgsuniquevaluerenderer.cpp

示例9: parseXml

void RegistrationImplService::parseXml(QDomNode& dataNode)
{
	QString fixedData = dataNode.namedItem("fixedDataUid").toElement().text();
	this->setFixedData(fixedData);

	QString movingData = dataNode.namedItem("movingDataUid").toElement().text();
	this->setMovingData(movingData);
}
开发者ID:normit-nav,项目名称:CustusX,代码行数:8,代码来源:cxRegistrationImplService.cpp

示例10: process

void Search::process()
{
    Parse parse;
    m_videoList = parse.parseRSS(m_document);

    QDomNodeList entries = m_document.elementsByTagName("channel");

    if (entries.count() == 0)
    {
        m_numResults = 0;
        m_numReturned = 0;
        m_numIndex = 0;
        return;
    }

    QDomNode itemNode = entries.item(0);

    QDomNode Node = itemNode.namedItem(QString("numresults"));
    if (!Node.isNull())
    {
        m_numResults = Node.toElement().text().toUInt();
    }
    else
    {
        QDomNodeList count = m_document.elementsByTagName("item");

        if (count.count() == 0)
            m_numResults = 0;
        else
            m_numResults = count.count();
    }

    Node = itemNode.namedItem(QString("returned"));
    if (!Node.isNull())
    {
        m_numReturned = Node.toElement().text().toUInt();
    }
    else
    {
        QDomNodeList entries = m_document.elementsByTagName("item");

        if (entries.count() == 0)
            m_numReturned = 0;
        else
            m_numReturned = entries.count();
    }

    Node = itemNode.namedItem(QString("startindex"));
    if (!Node.isNull())
    {
        m_numIndex = Node.toElement().text().toUInt();
    }
    else
        m_numIndex = 0;

}
开发者ID:Beirdo,项目名称:mythtv-stabilize,代码行数:56,代码来源:netgrabbermanager.cpp

示例11: QDialog

configInfo::configInfo(DomCfgItem *item,QWidget * parent , Qt::WindowFlags f ): QDialog(parent,f),node(item)
{
    setupUi(this);
    node = item;
    QDomNode info = node->root()->node().namedItem(md_root).namedItem(md_info);
    editInfo->setText(info.namedItem(md_info_name).toElement().text());
    autorEdit->setText(info.namedItem(md_info_author).toElement().text());
    dateEdit->setDate(QDate::fromString(info.namedItem(md_info_date).toElement().text()));
    commentEdit->setText(info.namedItem(md_info_remark).toElement().text());
}
开发者ID:asokolov,项目名称:ananas-creator,代码行数:10,代码来源:configinfo.cpp

示例12: parseResults

void YoutubeModel::parseResults(KJob *job)
{
    if (!m_datas.contains(static_cast<KIO::Job*>(job))) {
        return;
    }

    QDomDocument document;
    document.setContent(m_datas[static_cast<KIO::Job*>(job)]);

    QDomNodeList entries = document.elementsByTagName("entry");
    for (int i = 0; i < entries.count(); i++) {
        QString id = entries.at(i).namedItem("id").toElement().text().split(':').last();
        QString title = entries.at(i).namedItem("title").toElement().text();
        QDomNode mediaNode = entries.at(i).namedItem("media:group");
        QString description = mediaNode.namedItem("media:description").toElement().text();
        QString keywords = mediaNode.namedItem("media:keywords").toElement().text();
        QString mediaUrl = mediaNode.namedItem("media:player").toElement().attribute("url");
	uint mediaDuration = mediaNode.namedItem("yt:duration").toElement().attribute("seconds").toInt();
        // FIXME: more than one media:thumbnail exists
        QString thumbnail = mediaNode.namedItem("media:thumbnail").toElement().attribute("url");

        QDomNode n = mediaNode.firstChild();
        QString MEDIA_CONTENT_URL;
        QString MEDIA_CONTENT_TYPE;
        do {
            if (n.nodeName() == "media:content" && n.toElement().attribute("yt:format") == "5") {
                MEDIA_CONTENT_URL = n.toElement().attribute("url");
                MEDIA_CONTENT_TYPE = n.toElement().attribute("type");
                break;
            }
            n = n.nextSibling();
        } while (n != mediaNode.lastChild());

        QString embeddedHTML = QString(
        "<object width=\"425\" height=\"350\">\n"
        "<param name=\"movie\" value=\"%1\"></param>\n"
        "<embed src=\"%2\"\n"
        "type=\"%3\" width=\"425\" height=\"350\">\n"
        "</embed>\n"
        "</object>\n").arg(MEDIA_CONTENT_URL, MEDIA_CONTENT_URL, MEDIA_CONTENT_TYPE);

        VideoPackage video;
        video.title = title;
        video.description = description;
        video.keywords = keywords.split(", ");
        video.id = id;
        video.duration = mediaDuration;
        video.embeddedHTML = embeddedHTML;
        video.thumbnail = thumbnail;
        video.url = mediaUrl;

        m_videos << video;
        reset();
    }
}
开发者ID:KDE,项目名称:plasma-mediacenter,代码行数:55,代码来源:youtubemodel.cpp

示例13: valorItem

/**
\param formula
\param valoract
\param valorant
\return
**/
bool BcCuentasAnualesImprimirView::valorItem ( const QDomNode &formula, QString &valoract, QString &valorant )
{
    BL_FUNC_DEBUG
    QDomElement valor = formula.namedItem ( "VALORACT" ).toElement();
    if ( valor.isNull() ) {
        return false;
    } // end if
    valoract = valor.text();
    valorant = formula.namedItem ( "VALORANT" ).toElement().text();
    
    return true;
}
开发者ID:JustDevZero,项目名称:bulmages,代码行数:18,代码来源:bccuentasanualesimprimirview.cpp

示例14: readXML

bool QgsCoordinateTransform::readXML( QDomNode & theNode )
{

  QgsDebugMsg( "Reading Coordinate Transform from xml ------------------------!" );

  QDomNode mySrcNode = theNode.namedItem( "sourcesrs" );
  mSourceCRS.readXML( mySrcNode );

  QDomNode myDestNode = theNode.namedItem( "destinationsrs" );
  mDestCRS.readXML( myDestNode );

  initialise();

  return true;
}
开发者ID:afrigeo,项目名称:Quantum-GIS,代码行数:15,代码来源:qgscoordinatetransform.cpp

示例15: handleResponse

QString RegexpHandler::handleResponse(const QString &raw, QDomNode arguments) const
{
  QString result;
  QRegExp e(arguments.namedItem("match").toElement().text());
  
  if (e.exactMatch(raw.trimmed())) {
    result = arguments.namedItem("display").toElement().text();
    
    for (int i = 1; i <= e.numCaptures(); i++) {
      result.replace(QString("\\%1").arg(i), e.cap(i));
    }
  }
  
  return result;
}
开发者ID:netrunner-debian-kde-extras,项目名称:kftpgrabber,代码行数:15,代码来源:handlers.cpp


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