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


C++ QDomElement函数代码示例

本文整理汇总了C++中QDomElement函数的典型用法代码示例。如果您正苦于以下问题:C++ QDomElement函数的具体用法?C++ QDomElement怎么用?C++ QDomElement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getElement

QDomElement StyleNode::getElement(QStringList path)
{
    if (path.size() < 1 || path.first() != elem.tagName() ) return QDomElement();

    if ( path.size() == 1) return elem;

    // Try to find this element among the children
    QDomElement e;
    int index = 0;
    while ( e.isNull() && index < children.size() )
    {
        e = children[index]->getElement(path.mid(1));
        index++;
    }
    if (!e.isNull() ) return e;

    // Try to find this element among the prototypes
    index = 0;
    while ( e.isNull() && index < prototypes.size() )
    {
        QStringList newPath = path.mid(1);
        newPath.prepend("style");
        e = prototypes[index]->getElement(newPath);
        index++;
    }

    return e;
}
开发者ID:helandre,项目名称:Envision,代码行数:28,代码来源:StyleNode.cpp

示例2: endElement

		bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
		{
			--depth;
			if(depth == 0) {
				Parser::Event *e = new Parser::Event;
				e->setDocumentClose(namespaceURI, localName, qName);
				e->setActualString(in->lastString());
				in->resetLastData();
				eventList.append(e);
				in->pause(true);
			}
			else {
				// done with a depth 1 element?
				if(depth == 1) {
					Parser::Event *e = new Parser::Event;
					e->setElement(elem);
					e->setActualString(in->lastString());
					in->resetLastData();
					eventList.append(e);
					in->pause(true);

					elem = QDomElement();
					current = QDomElement();
				}
				else
					current = current.parentNode().toElement();
			}

			if(in->lastRead() == '/')
				checkNeedMore();

			return true;
		}
开发者ID:BackupTheBerlios,项目名称:synapse-xmpp-svn,代码行数:33,代码来源:parser.cpp

示例3: QDomElement

QDomElement QgsServerProjectParser::firstComposerLegendElement() const
{
  if ( !mXMLDoc )
  {
    return QDomElement();
  }

  QDomElement documentElem = mXMLDoc->documentElement();
  if ( documentElem.isNull() )
  {
    return QDomElement();
  }

  QDomElement composerElem = documentElem.firstChildElement( "Composer" );
  if ( composerElem.isNull() )
  {
    return QDomElement();
  }
  QDomElement compositionElem = composerElem.firstChildElement( "Composition" );
  if ( compositionElem.isNull() )
  {
    return QDomElement();
  }
  return compositionElem.firstChildElement( "ComposerLegend" );
}
开发者ID:V17nika,项目名称:QGIS,代码行数:25,代码来源:qgsserverprojectparser.cpp

示例4: QDomElement

QDomElement XmlHelper::GetXmlNodeParent(const QString &node_tag)
{
    if (!LoadXmlFile())
    {
        return QDomElement();
    }

    QDomNodeList node_list = doc_.elementsByTagName(node_tag);
    if (node_list.count() > 0)
    {
        return node_list.at(0).toElement();
    }

    return QDomElement();
}
开发者ID:liye0005,项目名称:QT_POJ,代码行数:15,代码来源:xmlhelper.cpp

示例5: QDomElement

void Item::setSaveToElement(bool val) {
    _saveToElement = val;

    // if we don't want direct saving, clear the memory
    if (!_saveToElement)
        _node = QDomElement();
}
开发者ID:burillo-se,项目名称:bfd3me,代码行数:7,代码来源:item.cpp

示例6: rootFromName

 //@Override
 /*public*/ void OperationsSetupXml::readFile(QString name) //throw (JDOMException, IOException)
 {
     // suppress rootFromName(name) warning message by checking to see if file exists
     if (findFile(name) == NULL) {
         log->debug(tr("%1 file could not be found").arg(name));
         return;
     }
     // find root
     QDomElement root = rootFromName(name);
     if (root == QDomElement())
     {
      log->debug(tr("%1 file could not be read").arg(name));
      return;
     }
     Setup::load(root);

     // load manifest header text strings
     TrainManifestHeaderText::load(root);

     // load manifest text strings
     TrainManifestText::load(root);

     // load switch list text strings
     TrainSwitchListText::load(root);

     // load control settings
     Control::load(root);
 }
开发者ID:allenck,项目名称:DecoderPro_app,代码行数:29,代码来源:operationssetupxml.cpp

示例7: ownerElement

QDomElement QDomAttrProto:: ownerElement() const
{
  QDomAttr *item = qscriptvalue_cast<QDomAttr*>(thisObject());
  if (item)
    return item->ownerElement();
  return QDomElement();
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:7,代码来源:qdomattrproto.cpp

示例8: QDomElement

QDomElement QgsWFSServer::createPolygonElem( QgsGeometry* geom, QDomDocument& doc ) const
{
  if ( !geom )
  {
    return QDomElement();
  }

  QDomElement polygonElem = doc.createElement( "gml:Polygon" );
  QgsPolygon poly = geom->asPolygon();
  for ( int i = 0; i < poly.size(); ++i )
  {
    QString boundaryName;
    if ( i == 0 )
    {
      boundaryName = "outerBoundaryIs";
    }
    else
    {
      boundaryName = "innerBoundaryIs";
    }
    QDomElement boundaryElem = doc.createElementNS( "http://www.opengis.net/gml", boundaryName );
    QDomElement ringElem = doc.createElement( "gml:LinearRing" );
    QDomElement coordElem = createCoordinateElem( poly.at( i ), doc );
    ringElem.appendChild( coordElem );
    boundaryElem.appendChild( ringElem );
    polygonElem.appendChild( boundaryElem );
  }
  return polygonElem;
}
开发者ID:mokerjoke,项目名称:Quantum-GIS,代码行数:29,代码来源:qgswfsserver.cpp

示例9: while

QString ElementWrapper::xmlBase() const
{
    if (!d->xmlBaseParsed) // xmlBase not computed yet
    {
        QDomElement current = d->element;
        
        while (!current.isNull())
        {
            if (current.hasAttributeNS(xmlNamespace(), QLatin1String("base")))
            {
                d->xmlBase = current.attributeNS(xmlNamespace(), QLatin1String("base"));
                return d->xmlBase;
            }
            
            QDomNode parent = current.parentNode();

            if (!parent.isNull() && parent.isElement())
                current = parent.toElement();
            else
                current = QDomElement();
        }
        
        d->xmlBaseParsed = true;
    }
    
    return d->xmlBase;
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:27,代码来源:elementwrapper.cpp

示例10: qDebug

QDomElement ASkinner::skinModuleElement(QString module, QString elementName) {
   QDomElement moduleRoot = modules.firstChildElement(module);
   if(!moduleRoot.isNull()) {
      QDomElement objectRoot = moduleRoot.firstChildElement(elementName);
      if(!objectRoot.isNull()) {
         qDebug() << "Loaded skin element: " << elementName;
         return objectRoot;
      } else {
         qDebug() << "No such element in module" << module << "skin defenition:" << elementName;
         return QDomElement();
      }
   } else {
      qDebug() << "ERROR: No configuration for" << module << "in this skin!";
      return QDomElement();
   }
}
开发者ID:yjfcool,项目名称:lyxcar,代码行数:16,代码来源:skinner.cpp

示例11: qDebug

QList<QTreeWidgetItem*> BtBookmarkLoader::loadTree(QString fileName)
{
	qDebug() << "BtBookmarkLoader::loadTree";
	QList<QTreeWidgetItem*> itemList;
	
	QDomDocument doc;
	doc.setContent(loadXmlFromFile(fileName));
	
	//bookmarkfolder::loadBookmarksFromXML()
	
	QDomElement document = doc.documentElement();
	if( document.tagName() != "SwordBookmarks" ) {
		qWarning("Not a BibleTime Bookmark XML file");
		return QList<QTreeWidgetItem*>();
	}

	QDomElement child = document.firstChild().toElement();

	while ( !child.isNull() && child.parentNode() == document) {
		qDebug() << "BtBookmarkLoader::loadTree while start";
		QTreeWidgetItem* i = handleXmlElement(child, 0);
		itemList.append(i);
		if (!child.nextSibling().isNull()) {
			child = child.nextSibling().toElement();
		} else {
			child = QDomElement(); //null
		}
		
	}

	return itemList;
}
开发者ID:bibletime,项目名称:historic-bibletime-svn,代码行数:32,代码来源:btbookmarkloader.cpp

示例12: ParseQuery

bool ParseQuery(const QByteArray& data, XmlQuery* query,
                bool* connection_problems) {
  try {
    *query = lastfm::XmlQuery(data);
#ifdef Q_OS_WIN32
    if (lastfm::ws::last_parse_error != lastfm::ws::NoError) {
      return false;
    }
#endif  // Q_OS_WIN32
  } catch (lastfm::ws::ParseError e) {
    qLog(Error) << "Last.fm parse error: " << e.enumValue();
    if (connection_problems) {
      *connection_problems = e.enumValue() == lastfm::ws::MalformedResponse;
    }
    return false;
  } catch (std::runtime_error& e) {
    qLog(Error) << e.what();
    return false;
  }

  if (connection_problems) {
    *connection_problems = false;
  }

  // Check for app errors.
  if (QDomElement(*query).attribute("status") == "failed") {
    return false;
  }

  return true;
}
开发者ID:Aceler,项目名称:Clementine,代码行数:31,代码来源:lastfmcompat.cpp

示例13: kDebug

QDomElement RecordingSet::serialize(QDomDocument *doc) const
{
  if (m_isNull) return QDomElement();

  QDomElement recordingSetElem = doc->createElement("ttsset");
  recordingSetElem.setAttribute("id", QString::number(m_id));

  QDomElement nameElem = doc->createElement("name");
  nameElem.appendChild(doc->createTextNode(m_name));
  QDomElement recordingsElem = doc->createElement("recordings");
  QList<RecordingSetText> texts = m_recordings.keys();

  kDebug() << "Available texts:";
  kDebug() << texts;

  foreach (const RecordingSetText& text, texts)
  {
    QDomElement recordingElem = doc->createElement("recording");
    QDomElement textElem = doc->createElement("text");
    QDomElement pathElem = doc->createElement("path");
    textElem.appendChild(doc->createTextNode(text));
    pathElem.appendChild(doc->createTextNode(m_recordings.value(text)));
    recordingElem.appendChild(textElem);
    recordingElem.appendChild(pathElem);
    recordingsElem.appendChild(recordingElem);
  }
开发者ID:KDE,项目名称:simon,代码行数:26,代码来源:recordingset.cpp

示例14: QDomElement

QDomElement JingleContent::nextCandidate()
{
    if (!FTransportCandidates.isEmpty() && FTransportCandidateItreator!=FTransportCandidates.constEnd())
        return *(FTransportCandidateItreator++);
    else
        return QDomElement();
}
开发者ID:RoadWorksSoftware,项目名称:eyecu-qt,代码行数:7,代码来源:jinglesession.cpp

示例15: handleStanza

void QXmppStream::_q_socketReadyRead()
{
    d->dataBuffer.append(d->socket->readAll());

    // handle whitespace pings
    if (!d->dataBuffer.isEmpty() && d->dataBuffer.trimmed().isEmpty()) {
        d->dataBuffer.clear();
        handleStanza(QDomElement());
    }

    // FIXME : maybe these QRegExps could be static?
    QRegExp startStreamRegex("^(<\\?xml.*\\?>)?\\s*<stream:stream.*>");
    startStreamRegex.setMinimal(true);
    QRegExp endStreamRegex("</stream:stream>$");
    endStreamRegex.setMinimal(true);

    // check whether we need to add stream start / end elements
    //
    // NOTE: as we may only have partial XML content, do not alter the stream's
    // state until we have a valid XML document!
    QByteArray completeXml = d->dataBuffer;
    const QString strData = QString::fromUtf8(d->dataBuffer);
    bool streamStart = false;
    if (d->streamStart.isEmpty() && strData.contains(startStreamRegex))
        streamStart = true;
    else
        completeXml.prepend(d->streamStart);
    bool streamEnd = false;
    if (strData.contains(endStreamRegex))
        streamEnd = true;
    else
        completeXml.append(streamRootElementEnd);

    // check whether we have a valid XML document
    QDomDocument doc;
    if (!doc.setContent(completeXml, true))
        return;

    // remove data from buffer
    logReceived(strData);
    d->dataBuffer.clear();

    // process stream start
    if (streamStart) {
        d->streamStart = startStreamRegex.cap(0).toUtf8();
        handleStream(doc.documentElement());
    }

    // process stanzas
    QDomElement nodeRecv = doc.documentElement().firstChildElement();
    while (!nodeRecv.isNull()) {
        handleStanza(nodeRecv);
        nodeRecv = nodeRecv.nextSiblingElement();
    }

    // process stream end
    if (streamEnd)
        disconnectFromHost();
}
开发者ID:misterion,项目名称:qxmpp,代码行数:59,代码来源:QXmppStream.cpp


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