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


C++ QDomElement::namespaceURI方法代码示例

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


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

示例1: while

/// \cond
void QXmppJingleIq::Content::parse(const QDomElement &element)
{
    m_creator = element.attribute("creator");
    m_disposition = element.attribute("disposition");
    m_name = element.attribute("name");
    m_senders = element.attribute("senders");

    // description
    QDomElement descriptionElement = element.firstChildElement("description");
    m_descriptionType = descriptionElement.namespaceURI();
    m_descriptionMedia = descriptionElement.attribute("media");
    QDomElement child = descriptionElement.firstChildElement("payload-type");
    while (!child.isNull())
    {
        QXmppJinglePayloadType payload;
        payload.parse(child);
        m_payloadTypes << payload;
        child = child.nextSiblingElement("payload-type");
    }

    // transport
    QDomElement transportElement = element.firstChildElement("transport");
    m_transportType = transportElement.namespaceURI();
    m_transportUser = transportElement.attribute("ufrag");
    m_transportPassword = transportElement.attribute("pwd");
    child = transportElement.firstChildElement("candidate");
    while (!child.isNull())
    {
        QXmppJingleCandidate candidate;
        candidate.parse(child);
        m_transportCandidates << candidate;
        child = child.nextSiblingElement("candidate");
    }
}
开发者ID:DenisKlimenko,项目名称:QXMPP-CMake,代码行数:35,代码来源:QXmppJingleIq.cpp

示例2: d

/**
 * Constructs stream-error object from a DOM element.
 *
 * @param element   \<stream:error/\> DOM element.
 */
StreamError::StreamError(const QDomElement& element)
    : d(new Private)
{
    QDomNode root = d->doc.importNode(element, true);
    d->doc.appendChild(root);

    QDomNodeList childs = root.childNodes();
    for (int i = 0; i < childs.count(); ++i) {
        QDomElement element = childs.item(i).toElement();
        if (element.namespaceURI() == NS_STREAMS) {
            int condition = Private::stringToCondition(element.tagName() );
            if ( condition != -1 ) {
                d->errorCondition = element;
                break;
            }
        }
    }

    QDomElement eText = root.firstChildElement("text");
    if (eText.namespaceURI() == NS_STREAMS) {
        d->text = eText;
    }

    for (int i = 0; i < childs.count(); ++i) {
        QDomElement element = childs.item(i).toElement();
        /* first element outside NS_STREAMS ns will be an app-specific error condition */
        if (element.namespaceURI() != NS_STREAMS) {
            d->appSpec = element;
        }
    }
}
开发者ID:holycheater,项目名称:qt-icq-transport,代码行数:36,代码来源:streamerror.cpp

示例3: stripAnswers

QString XmlUtil::stripAnswers(const QString &input) {
	QDomDocument doc;
	doc.setContent(input);
	QDomElement docElem = doc.documentElement();

	QDomNode n = docElem.firstChild();
	while ( !n.isNull() ) {
		QDomElement e = n.toElement();
		if ( !e.isNull() && (e.namespaceURI().isEmpty() || e.namespaceURI() == XML_NS) ) {
			if ( e.nodeName() == "choose" ) {
				QDomElement c = e.firstChildElement("choice");
				while ( !c.isNull() ) {
					c.removeAttribute("answer");
					c = c.nextSiblingElement("choice");
				}
			} else if ( e.nodeName() == "identification" ) {
				QDomElement a = e.firstChildElement("a");
				while ( !a.isNull() ) {
					e.removeChild(a);
					a = e.firstChildElement("a");
				}
			}
		}
		n = n.nextSibling();
	}
	return doc.toString(2);
}
开发者ID:trigger-happy,项目名称:Cerberus,代码行数:27,代码来源:xml_util.cpp

示例4: saveData

QString PrivateStorage::saveData(const Jid &AStreamJid, const QDomElement &AElement)
{
	if (FStanzaProcessor && isOpen(AStreamJid) && !AElement.tagName().isEmpty() && !AElement.namespaceURI().isEmpty())
	{
		Stanza request(STANZA_KIND_IQ);
		request.setType(STANZA_TYPE_SET).setUniqueId();
		QDomElement elem = request.addElement("query",NS_JABBER_PRIVATE);
		elem.appendChild(AElement.cloneNode(true));
		if (FStanzaProcessor->sendStanzaRequest(this,AStreamJid,request,PRIVATE_STORAGE_TIMEOUT))
		{
			LOG_STRM_INFO(AStreamJid,QString("Private data save request sent, ns=%1, id=%2").arg(AElement.namespaceURI(),request.id()));
			if (FPreClosedStreams.contains(AStreamJid))
				notifyDataChanged(AStreamJid,AElement.tagName(),AElement.namespaceURI());
			FSaveRequests.insert(request.id(),insertElement(AStreamJid,AElement));
			return request.id();
		}
		else
		{
			LOG_STRM_WARNING(AStreamJid,QString("Failed to send private data save request, ns=%1").arg(AElement.namespaceURI()));
		}
	}
	else if (!isOpen(AStreamJid))
	{
		REPORT_ERROR("Failed to save private data: Storage is not opened");
	}
	else if (AElement.tagName().isEmpty() || AElement.namespaceURI().isEmpty())
	{
		REPORT_ERROR("Failed to save private data: Invalid data");
	}
	return QString::null;
}
开发者ID:Vacuum-IM,项目名称:vacuum-im,代码行数:31,代码来源:privatestorage.cpp

示例5: parse

void QXmppStreamFeatures::parse(const QDomElement &element)
{
    m_bindMode = readFeature(element, "bind", ns_bind);
    m_sessionMode = readFeature(element, "session", ns_session);
    m_nonSaslAuthMode = readFeature(element, "auth", ns_authFeature);
    m_tlsMode = readFeature(element, "starttls", ns_tls);
    m_streamManagementMode = readFeature(element, "sm", ns_stream_management);

    // parse advertised compression methods
    QDomElement compression = element.firstChildElement("compression");
    if (compression.namespaceURI() == ns_compressFeature)
    {
        QDomElement subElement = compression.firstChildElement("method");
        while(!subElement.isNull())
        {
            m_compressionMethods << subElement.text();
            subElement = subElement.nextSiblingElement("method");
        }
    }

    // parse advertised SASL Authentication mechanisms
    QDomElement mechs = element.firstChildElement("mechanisms");
    if (mechs.namespaceURI() == ns_sasl)
    {
        QDomElement subElement = mechs.firstChildElement("mechanism");
        while(!subElement.isNull()) {
            m_authMechanisms << subElement.text();
            subElement = subElement.nextSiblingElement("mechanism");
        }
    }
}
开发者ID:trulabs,项目名称:qxmpp,代码行数:31,代码来源:QXmppStreamFeatures.cpp

示例6: writeElementChilds

void FileWriter::writeElementChilds(const QDomElement &AParent)
{
	QDomNode node = AParent.firstChild();
	while (!node.isNull())
	{
		if (node.isElement())
		{
			QDomElement elem = node.toElement();
			if (elem.tagName() != "thread")
			{
				FXmlWriter->writeStartElement(elem.tagName());

				QString elemNs = elem.namespaceURI();
				if (!elemNs.isEmpty() && elem.parentNode().namespaceURI()!=elemNs)
					FXmlWriter->writeAttribute("xmlns",elem.namespaceURI());

				QDomNamedNodeMap attrMap = elem.attributes();
				for (uint i=0; i<attrMap.length(); i++)
				{
					QDomNode attrNode = attrMap.item(i);
					FXmlWriter->writeAttribute(attrNode.nodeName(), attrNode.nodeValue());
				}

				writeElementChilds(elem);
				FXmlWriter->writeEndElement();
			}
		}
		else if (node.isCharacterData())
		{
			FXmlWriter->writeCharacters(node.toCharacterData().data());
		}

		node = node.nextSibling();
	}
}
开发者ID:ChALkeR,项目名称:vacuum-im,代码行数:35,代码来源:filewriter.cpp

示例7: stanzaRequestResult

void PrivateStorage::stanzaRequestResult(const Jid &AStreamJid, const Stanza &AStanza)
{
	if (FSaveRequests.contains(AStanza.id()))
	{
		QDomElement dataElem = FSaveRequests.take(AStanza.id());
		if (AStanza.isResult())
		{
			LOG_STRM_INFO(AStreamJid,QString("Private data saved on server, ns=%1, id=%2").arg(dataElem.namespaceURI(),AStanza.id()));
			notifyDataChanged(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		}
		else
		{
			LOG_STRM_WARNING(AStreamJid,QString("Private data saved in local storage, ns=%1, id=%2: %3").arg(dataElem.namespaceURI(),AStanza.id(),XmppStanzaError(AStanza).condition()));
		}
		saveOptionsElement(AStreamJid,dataElem);
		emit dataSaved(AStanza.id(),AStreamJid,dataElem);
	}
	else if (FLoadRequests.contains(AStanza.id()))
	{
		QDomElement dataElem; 
		QDomElement loadElem = FLoadRequests.take(AStanza.id());
		if (AStanza.isResult())
		{
			dataElem = AStanza.firstElement("query",NS_JABBER_PRIVATE).firstChildElement(loadElem.tagName());
			LOG_STRM_INFO(AStreamJid,QString("Private data loaded from server, ns=%1, id=%2").arg(loadElem.namespaceURI(),AStanza.id()));
		}
		else
		{
			LOG_STRM_WARNING(AStreamJid,QString("Private data loaded from local storage, ns=%1, id=%2: %3").arg(loadElem.namespaceURI(),AStanza.id(),XmppStanzaError(AStanza).condition()));
		}
		if (dataElem.isNull())
			dataElem = loadOptionsElement(AStreamJid,loadElem.tagName(),loadElem.namespaceURI());
		emit dataLoaded(AStanza.id(),AStreamJid,insertElement(AStreamJid,dataElem));
	}
	else if (FRemoveRequests.contains(AStanza.id()))
	{
		QDomElement dataElem = FRemoveRequests.take(AStanza.id());
		if (AStanza.isResult())
		{
			LOG_STRM_INFO(AStreamJid,QString("Private data removed from server, ns=%1, id=%2").arg(dataElem.namespaceURI(),AStanza.id()));
			notifyDataChanged(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		}
		else
		{
			LOG_STRM_WARNING(AStreamJid,QString("Private data removed from local storage, ns=%1, id=%2: %3").arg(dataElem.namespaceURI(),AStanza.id(),XmppStanzaError(AStanza).condition()));
		}
		removeElement(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		removeOptionsElement(AStreamJid,dataElem.tagName(),dataElem.namespaceURI());
		emit dataRemoved(AStanza.id(),AStreamJid,dataElem);
	}
}
开发者ID:Vacuum-IM,项目名称:vacuum-im,代码行数:51,代码来源:privatestorage.cpp

示例8: helperToXmlAddDomElement

static void helperToXmlAddDomElement(QXmlStreamWriter* stream, const QDomElement& element, const QStringList &omitNamespaces)
{
    stream->writeStartElement(element.tagName());

    /* attributes */
    QString xmlns = element.namespaceURI();
    if (!xmlns.isEmpty() && !omitNamespaces.contains(xmlns))
        stream->writeAttribute("xmlns", xmlns);
    QDomNamedNodeMap attrs = element.attributes();
    for (int i = 0; i < attrs.size(); i++)
    {
        QDomAttr attr = attrs.item(i).toAttr();
        stream->writeAttribute(attr.name(), attr.value());
    }

    /* children */
    QDomNode childNode = element.firstChild();
    while (!childNode.isNull())
    {
        if (childNode.isElement())
        {
            helperToXmlAddDomElement(stream, childNode.toElement(), QStringList() << xmlns);
        } else if (childNode.isText()) {
            stream->writeCharacters(childNode.toText().data());
        }
        childNode = childNode.nextSibling();
    }
    stream->writeEndElement();
}
开发者ID:unisontech,项目名称:qxmpp,代码行数:29,代码来源:QXmppServer.cpp

示例9: handleStanza

bool QXmppCarbonManager::handleStanza(const QDomElement &element)
{
    if(element.tagName() != "message")
        return false;

    bool sent = true;
    QDomElement carbon = element.firstChildElement("sent");
    if(carbon.isNull()) {
        carbon = element.firstChildElement("received");
        sent = false;
    }

    if(carbon.isNull() || carbon.namespaceURI() != ns_carbons)
        return false;   // Neither sent nor received -> no carbon message

    QDomElement forwarded = carbon.firstChildElement("forwarded");
    if(forwarded.isNull())
        return false;

    QDomElement messageelement = forwarded.firstChildElement("message");
    if(messageelement.isNull())
        return false;

    QXmppMessage message;
    message.parse(messageelement);

    if(sent)
        emit messageSent(message);
    else
        emit messageReceived(message);

    return true;
}
开发者ID:qxmpp-project,项目名称:qxmpp,代码行数:33,代码来源:QXmppCarbonManager.cpp

示例10: getData

QDomElement PrivateStorage::getData(const Jid &AStreamJid, const QString &ATagName, const QString &ANamespace) const
{
	QDomElement elem = FStreamElements.value(AStreamJid).firstChildElement(ATagName);
	while (!elem.isNull() && elem.namespaceURI()!=ANamespace)
		elem= elem.nextSiblingElement(ATagName);
	return elem;
}
开发者ID:Vacuum-IM,项目名称:vacuum-im,代码行数:7,代码来源:privatestorage.cpp

示例11: isRpcResponseIq

/// \cond
bool QXmppRpcResponseIq::isRpcResponseIq(const QDomElement &element)
{
    QString type = element.attribute("type");
    QDomElement dataElement = element.firstChildElement("query");
    return dataElement.namespaceURI() == ns_rpc &&
           type == "result";
}
开发者ID:Lerentis,项目名称:qxmpp,代码行数:8,代码来源:QXmppRpcIq.cpp

示例12: dublinCoreNamespace

QList<QDomElement> Item::unhandledElements() const
{
    // TODO: do not hardcode this list here
    QList<ElementType> handled;
    handled.append(ElementType(QLatin1String("title")));
    handled.append(ElementType(QLatin1String("link")));
    handled.append(ElementType(QLatin1String("description")));
    handled.append(ElementType(QLatin1String("pubDate")));
    handled.append(ElementType(QLatin1String("expirationDate")));
    handled.append(ElementType(QLatin1String("rating")));
    handled.append(ElementType(QLatin1String("source")));
    handled.append(ElementType(QLatin1String("guid")));
    handled.append(ElementType(QLatin1String("comments")));
    handled.append(ElementType(QLatin1String("author")));
    handled.append(ElementType(QLatin1String("date"), dublinCoreNamespace()));
    
    QList<QDomElement> notHandled;
    
    QDomNodeList children = element().childNodes();
    for (int i = 0; i < children.size(); ++i)
    {
        QDomElement el = children.at(i).toElement();
        if (!el.isNull() 
             && !handled.contains(ElementType(el.localName(), el.namespaceURI())))
        {
            notHandled.append(el);
        }
    }
    
    return notHandled;
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:31,代码来源:item.cpp

示例13: loadAnnotations

void Reader::loadAnnotations(const QDomElement& annotations)
{
	QDomNodeList nodes = annotations.childNodes();
	for(int n=0;n<nodes.count();++n) {
		QDomElement e = nodes.at(n).toElement();
		if(e.isNull())
			continue;
		if(e.namespaceURI()==DP_NAMESPACE && e.localName()=="a") {
			_commands.append(MessagePtr(new protocol::AnnotationCreate(
				0,
				++_annotationid,
				e.attribute("x").toInt(),
				e.attribute("y").toInt(),
				e.attribute("w").toInt(),
				e.attribute("h").toInt()
			)));
			_commands.append(MessagePtr(new protocol::AnnotationEdit(
				_annotationid,
				e.attribute("bg").mid(1).toUInt(0,16),
				e.text()
			)));
		} else {
			qWarning() << "unhandled annotations (DP ext.) element:" << e.tagName();
		}
	}
}
开发者ID:hexaditidom,项目名称:Drawpile,代码行数:26,代码来源:orareader.cpp

示例14: element

QList<QDomElement> Entry::unhandledElements() const
{
    // TODO: do not hardcode this list here
    QList<ElementType> handled;
    handled.append(ElementType(QLatin1String("author"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("contributor"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("category"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("id"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("link"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("rights"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("source"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("published"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("updated"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("summary"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("title"), atom1Namespace()));
    handled.append(ElementType(QLatin1String("content"), atom1Namespace()));
    
    QList<QDomElement> notHandled;
    
    QDomNodeList children = element().childNodes();
    for (int i = 0; i < children.size(); ++i)
    {
        QDomElement el = children.at(i).toElement();
        if (!el.isNull() 
             && !handled.contains(ElementType(el.localName(), el.namespaceURI())))
        {
            notHandled.append(el);
        }
    }
    
    return notHandled;
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:32,代码来源:entry.cpp

示例15: stripExtraNS

// stripExtraNS
//
// This function removes namespace information from various nodes for
// display purposes only (the element is pretty much useless for processing
// after this).  We do this because QXml is a bit overzealous about outputting
// redundant namespaces.
static QDomElement stripExtraNS(const QDomElement &e)
{
	// find closest parent with a namespace
	QDomNode par = e.parentNode();
	while(!par.isNull() && par.namespaceURI().isNull())
		par = par.parentNode();
	bool noShowNS = false;
	if(!par.isNull() && par.namespaceURI() == e.namespaceURI())
		noShowNS = true;

	// build qName (prefix:localName)
	QString qName;
	if(!e.prefix().isEmpty())
		qName = e.prefix() + ':' + e.localName();
	else
		qName = e.tagName();

	QDomElement i;
	int x;
	if(noShowNS)
		i = e.ownerDocument().createElement(qName);
	else
		i = e.ownerDocument().createElementNS(e.namespaceURI(), qName);

	// copy attributes
	QDomNamedNodeMap al = e.attributes();
	for(x = 0; x < al.count(); ++x) {
		QDomAttr a = al.item(x).cloneNode().toAttr();

		// don't show xml namespace
		if(a.namespaceURI() == NS_XML)
			i.setAttribute(QString("xml:") + a.name(), a.value());
		else
			i.setAttributeNodeNS(a);
	}

	// copy children
	QDomNodeList nl = e.childNodes();
	for(x = 0; x < nl.count(); ++x) {
		QDomNode n = nl.item(x);
		if(n.isElement())
			i.appendChild(stripExtraNS(n.toElement()));
		else
			i.appendChild(n.cloneNode());
	}
	return i;
}
开发者ID:ExtensionHealthcare,项目名称:iris,代码行数:53,代码来源:xmlprotocol.cpp


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