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


C++ QDomText::nodeValue方法代码示例

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


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

示例1: xmlObtenerTexto

/*
Esta funcion busca en el xmlDocumento hasta que encuentra el tag y retorna el valor del string contenido por el
@param tag: Es la etiqueta que contiene el texto buscado.
*/
QString SbXmlInterprete::xmlObtenerTexto(QString tag)
{
 	xmlElemento = xmlDocumento.documentElement(); // retorna la raiz del documento
	QDomNode nodo = xmlElemento.firstChild(); // se obtiene el primer Hijo

//	std::cout << "tagName: " << xmlElemento.tagName() << std::endl;
	
	while( ! nodo.isNull())
	{
		QDomElement elemento = nodo.toElement();
		QDomNode hijo = elemento.firstChild();

		while (! hijo.isNull())
		{
			QDomElement elemento2 = hijo.toElement();
			if ( !elemento2.isNull() )
			{
				QString tmpTagName = elemento2.tagName();
//				std::cout << tmpTagName;
				QDomText textChild = hijo.firstChild().toText();
				
				QString tmpTextData = textChild.nodeValue();
//				std::cout << ": " << tmpTextData << std::endl;
				if (elemento2.tagName() == tag)
				{
					return tmpTextData;
				}
			}
			hijo = hijo.nextSibling();
		}
		nodo = nodo.nextSibling();
	}
	return "";
}
开发者ID:BackupTheBerlios,项目名称:qapital-svn,代码行数:38,代码来源:sbxmlinterprete.cpp

示例2: getInt

int BeerXMLElement::getInt(const QDomText& textNode)
{
   bool ok;
   int ret;
   QString text = textNode.nodeValue();

   ret = text.toInt(&ok);
   if( !ok )
      Brewtarget::logE(QString("BeerXMLElement::getInt: %1 is not an integer. Line %2").arg(text).arg(textNode.lineNumber()) );

   return ret;
}
开发者ID:theophae,项目名称:brewtarget,代码行数:12,代码来源:BeerXMLElement.cpp

示例3: getBool

bool BeerXMLElement::getBool(const QDomText& textNode)
{
   QString text = textNode.nodeValue();

   if( text == "TRUE" )
      return true;
   else if( text == "FALSE" )
      return false;
   else
      Brewtarget::logE(QString("BeerXMLElement::getBool: %1 is not a boolean value. Line %2").arg(text).arg(textNode.lineNumber()) );

   return false;
}
开发者ID:theophae,项目名称:brewtarget,代码行数:13,代码来源:BeerXMLElement.cpp

示例4: getDateTime

QDateTime BeerXMLElement::getDateTime( QDomText const& textNode )
{
   bool ok = true;
   QDateTime ret;
   QString text = textNode.nodeValue();

   ret = QDateTime::fromString(text, Qt::ISODate);
   ok = ret.isValid();
   if( !ok )
      Brewtarget::logE(QString("BeerXMLElement::getDateTime: %1 is not a date. Line %2").arg(text).arg(textNode.lineNumber()) );

   return ret;
}
开发者ID:theophae,项目名称:brewtarget,代码行数:13,代码来源:BeerXMLElement.cpp

示例5: getDouble

// getVal =====================================================================
double BeerXMLElement::getDouble(const QDomText& textNode)
{
   bool ok;
   double ret;

   QString text = textNode.nodeValue();

   // ret = text.toDouble(&ok);
   ret = Brewtarget::toDouble(text,&ok);
   if( !ok )
      Brewtarget::logE(QString("BeerXMLElement::getDouble: %1 is not a number. Line %2").arg(text).arg(textNode.lineNumber()) );

   return ret;
}
开发者ID:theophae,项目名称:brewtarget,代码行数:15,代码来源:BeerXMLElement.cpp

示例6: GetValue

QString XmlConfiguration::GetValue( const QString &sSetting, QString sDefault ) 
{
    QDomNode node = FindNode( sSetting );

    if (!node.isNull())
    {
        // -=>TODO: This Always assumes firstChild is a Text Node... should change
        QDomText  oText = node.firstChild().toText();

        if (!oText.isNull())
            return oText.nodeValue();
    }

    return sDefault;
}
开发者ID:jhludwig,项目名称:mythtv,代码行数:15,代码来源:configuration.cpp

示例7: insertEmoticon

QDomText EmoticonExpander::insertEmoticon(QDomText textNode, const Emoticon &emoticon, int index) const
{
    int emoticonLength = emoticon.triggerText().length();

    QDomText afterEmoticon = textNode.splitText(index + emoticonLength);
    textNode.setNodeValue(textNode.nodeValue().mid(0, index));

    QDomElement emoticonElement = textNode.ownerDocument().createElement("img");
    emoticonElement.setAttribute("emoticon", emoticon.triggerText());
    emoticonElement.setAttribute("title", emoticon.triggerText());
    emoticonElement.setAttribute("alt", emoticon.triggerText());
    emoticonElement.setAttribute("src", "file:///" + m_pathProvider->emoticonPath(emoticon));
    textNode.parentNode().insertBefore(emoticonElement, afterEmoticon);

    return afterEmoticon;
}
开发者ID:vogel,项目名称:kadu,代码行数:16,代码来源:emoticon-expander.cpp

示例8: getHeaderInformation

void OutlineTree::getHeaderInformation( const QDomElement &header )
{
    // visit all children of the header element and look if you can make
    // something with it
    QDomNode node = header.firstChild();
    while ( !node.isNull() ) {
	if ( node.isElement() ) {
	    // case for the different header entries
	    if ( node.nodeName() == "title" ) {
		QDomText textChild = node.firstChild().toText();
		if ( !textChild.isNull() ) {
		    setColumnText( 0, textChild.nodeValue() );
		}
	    }
	}
	node = node.nextSibling();
    }
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:18,代码来源:outlinetree.cpp

示例9: getDate

QDate BeerXMLElement::getDate( QDomText const& textNode )
{
   bool ok = true;
   QDate ret;
   QString text = textNode.nodeValue();

   ret = QDate::fromString(text, "M/d/yyyy");
   ok = ret.isValid();
   // Dates have some odd inconsistencies.
   if( !ok )
   {
      ret = QDate::fromString(text,"d/M/yyyy");
      ok = ret.isValid();
   }

   if ( !ok )
      Brewtarget::logE(QString("BeerXMLElement::getDate: %1 is not an ISO date-time. Line %2").arg(text).arg(textNode.lineNumber()) );

   return ret;
}
开发者ID:theophae,项目名称:brewtarget,代码行数:20,代码来源:BeerXMLElement.cpp

示例10: GetNodeValue

QString SOAPClient::GetNodeValue( QDomNode &node, const QString &sName, const QString &sDefault )
{
    if (node.isNull())
        return sDefault;

    QString  sValue  = "";
    QDomNode valNode = FindNode( sName, node );

    if (!valNode.isNull())
    {
        // -=>TODO: Assumes first child is Text Node.

        QDomText  oText = valNode.firstChild().toText();

        if (!oText.isNull())
            sValue = oText.nodeValue();

        return QUrl::fromPercentEncoding(sValue.toUtf8());
    }

    return sDefault;
}
开发者ID:microe,项目名称:mythtv,代码行数:22,代码来源:soapclient.cpp

示例11: getResultFilePathFromResult

/**
 * Parses an xml reply form a start
 * @param xmlMessage XML message with tags data as root
 * @return Path of the decode file, or "" if there have been an error while parsing
 */
QString NMGNetperfXMLInterpret::getResultFilePathFromResult ( const QString & xmlMessage )
{
	QDomDocument doc;
	if ( !doc.setContent ( xmlMessage ) )
	{
		cerr << "Error: the document is not well formed." << endl;
		return "";
	}
	QDomElement root = doc.documentElement();
	QString resultPath = "";

	if ( root.tagName() != TAG_DATA )
		cerr << "Error root element at NMGNetperfXMLInterpret different from data (" << qPrintable ( root.tagName() ) << ")." << endl;
	else
	{
		for ( QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() )
		{
			if ( node.isElement() )
			{
				QDomElement elem = node.toElement();
				if ( elem.tagName() == TAG_DECODE_FILE )
				{
					QDomText id = elem.firstChild().toText();
					if ( id.isNull() )
						cerr << "Result file path node has no value!" << endl;
				}
				else if ( elem.tagName() == TAG_TEST_FILE )
				{
					QDomText id = elem.firstChild().toText();
					if ( !id.isNull() ) resultPath = id.nodeValue();
					else cerr << "Result file path node has no value!" << endl;
				}
				else cerr << "Incorrect Tag in Netperf XML reply (" << qPrintable ( elem.tagName() ) << ")." << endl;
			}
		}
	}
	return resultPath;
}
开发者ID:Shwe-123,项目名称:netmeter,代码行数:43,代码来源:nmgnetperfxmlinterpret.cpp

示例12: parseStatusMessage

/**
 * Parses the status message and returns the integer value of the status
 * @param xmlMessage
 * @return Status value or -1 if error
 */
int NMGNetperfXMLInterpret::parseStatusMessage ( const QString & xmlMessage )
{
	QDomDocument doc;
	if ( !doc.setContent ( xmlMessage ) )
	{
		cerr << "Error: the document is not well formed." << endl;
		return -1;
	}
	QDomElement root = doc.documentElement();

	if ( root.tagName() != TAG_DATA )
		cerr << "Error root element at NMGNetperfXMLInterpret different from data (" << qPrintable ( root.tagName() ) << ")." << endl;
	else
	{
		for ( QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() )
		{
			if ( node.isElement() )
			{
				QDomElement elem = node.toElement();
				if ( elem.tagName() == TAG_STATUS )
				{
					QDomText id = elem.firstChild().toText();
					if ( !id.isNull() )
					{
						bool ok;
						int num = id.nodeValue().toInt ( &ok );
						if ( ok ) return num;
					}
					else cerr << "The status node has no value!" << endl;
				}
#ifdef DEBUG
				else cerr << "Tag not managed in Netperf Status XML (" << elem.tagName() << ")." << endl;
#endif
			}
		}
	}
	return -1;
}
开发者ID:Shwe-123,项目名称:netmeter,代码行数:43,代码来源:nmgnetperfxmlinterpret.cpp

示例13: expandFirstEmoticon

QDomText EmoticonExpander::expandFirstEmoticon(QDomText textNode) const
{
    QString text = textNode.nodeValue().toLower();
    int textLength = text.length();

    if (0 == textLength)
        return QDomText();

    int currentEmoticonStart = -1;
    Emoticon currentEmoticon;

    EmoticonWalker walker(m_tree);

    for (int i = 0; i < textLength; i++)
    {
        Emoticon emoticon = walker.matchEmoticon(text.at(i), (i < textLength - 1) && text.at(i + 1).isLetter());
        if (emoticon.isNull())
            continue;

        // TODO: remove this dependency
        int emoticonStart = i - emoticon.triggerText().length() + 1;
        if (currentEmoticon.isNull() || currentEmoticonStart >= emoticonStart)
        {
            currentEmoticon = emoticon;
            currentEmoticonStart = emoticonStart;
            continue;
        }

        return insertEmoticon(textNode, currentEmoticon, currentEmoticonStart);
    }

    if (!currentEmoticon.isNull())
        insertEmoticon(textNode, currentEmoticon, currentEmoticonStart);

    return QDomText();
}
开发者ID:vogel,项目名称:kadu,代码行数:36,代码来源:emoticon-expander.cpp

示例14: parsePoint

Feature* parsePoint(QDomElement& e, Layer* aLayer)
{
    Node* P = NULL;

    QDomElement c = e.firstChildElement();
    while(!c.isNull() && !P) {
        if (c.tagName() == "coordinates") {
            QDomText t = c.firstChild().toText();
            QString s = t.nodeValue();
            QStringList tokens = s.split(",");
            qreal lon = tokens[0].toDouble();
            qreal lat = tokens[1].toDouble();
            Coord p(lon,lat);

            P = g_backend.allocNode(aLayer, p);
            aLayer->add(P);
            P->setTag("%kml:guid", kmlId);
        }

        c = c.nextSiblingElement();
    }

    return P;
}
开发者ID:chxyfish,项目名称:merkaartor,代码行数:24,代码来源:ImportExportKML.cpp

示例15: getResultFilePathFromResult

/**
 * Parses an xml reply form a start
 * @param xmlMessage XML message with tags data as root
 * @return Path of the decode file, or "" if there have been an error while parsing
 */
QString NMGMGenXMLInterpret::getResultFilePathFromResult(const QString & xmlMessage)
{
	QDomDocument doc;
	if(!doc.setContent(xmlMessage))
	{
		cerr << RED << "[ERROR] the document is not well formed." << ENDCOLOR << endl;
		return "";
	}
	NMGQDomSortElement root = doc.documentElement();
	QString resultPath = "";
	
	if(root.tagName()!=TAG_DATA) 
		cerr << RED << "[ERROR] root element at NMGMGenXMLInterpret different from data ("<< qPrintable(root.tagName()) <<")."<< ENDCOLOR <<endl;
	else
	{
		for(QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling())
		{
			if(node.isElement())
			{
				NMGQDomSortElement elem = node.toElement();
				if(elem.tagName()==TAG_DECODE_FILE)
				{
					QString text = "";
					QDomText id = elem.firstChild().toText();
					if(!id.isNull()) text = id.nodeValue();
					//if(!id.isNull()) resultPath = id.nodeValue();
					//else cerr << "The decode result path node has no value!" << endl;
				}
				else if(elem.tagName()==TAG_RESULT_FILE)
				{
					QString text = "";
					QDomText id = elem.firstChild().toText();
					if(!id.isNull()) text = id.nodeValue();
					
				}
				else if(elem.tagName()==TAG_TEST_FILE)
				{
					//QString text = "";
					QDomText id = elem.firstChild().toText();
					if(!id.isNull()) resultPath = id.nodeValue();
					else cerr << "The decode result path node has no value!" << endl;
				}
				else if(elem.tagName()==TAG_RESULT_GRAPH_OWDD)
				{
					QString text = "";
					QDomText id = elem.firstChild().toText();
					if(!id.isNull()) text = id.nodeValue();
					
				}
				else if(elem.tagName()==TAG_RESULT_GRAPH_IPDV)
				{
					QString text = "";
					QDomText id = elem.firstChild().toText();
					if(!id.isNull()) text = id.nodeValue();
					
				}
				else if(elem.tagName()==TAG_RESULT_GRAPH_IPDVD)
				{
					QString text = "";
					QDomText id = elem.firstChild().toText();
					if(!id.isNull()) text = id.nodeValue();
					
				}
				else if(elem.tagName()==TAG_TIME_FILE)
				{
					
				}
				else cerr << "Tag not correct in Mgen XML reply (" << qPrintable(elem.tagName()) <<")." << endl;
			}
		}
	}
	return resultPath;
}
开发者ID:Shwe-123,项目名称:netmeter,代码行数:78,代码来源:nmgmgenxmlinterpret.cpp


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