本文整理汇总了C++中QDomElement::setAttributeNS方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomElement::setAttributeNS方法的具体用法?C++ QDomElement::setAttributeNS怎么用?C++ QDomElement::setAttributeNS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomElement
的用法示例。
在下文中一共展示了QDomElement::setAttributeNS方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: docElement
QDomElement BasicProtocol::docElement()
{
// create the root element
QDomElement e = doc.createElementNS(NS_ETHERX, "stream:stream");
QString defns = defaultNamespace();
const QStringList list = extraNamespaces();
// HACK: using attributes seems to be the only way to get additional namespaces in here
if(!defns.isEmpty())
e.setAttribute("xmlns", defns);
for(QStringList::ConstIterator it = list.begin(); it != list.end();) {
QString prefix = *(it++);
QString uri = *(it++);
e.setAttribute(QString("xmlns:") + prefix, uri);
}
// additional attributes
if(!isIncoming() && !to.isEmpty())
e.setAttribute("to", to);
if(isIncoming() && !from.isEmpty())
e.setAttribute("from", from);
if(!id.isEmpty())
e.setAttribute("id", id);
if(!lang.isEmpty())
e.setAttributeNS(NS_XML, "xml:lang", lang);
if(version.major > 0 || version.minor > 0)
e.setAttribute("version", QString::number(version.major) + '.' + QString::number(version.minor));
return e;
}
示例2: startElement
bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
{
if(depth == 0) {
Parser::Event *e = new Parser::Event;
QXmlAttributes a;
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
if(a.index(uri, ln) == -1)
a.append(atts.qName(n), uri, ln, atts.value(n));
}
e->setDocumentOpen(namespaceURI, localName, qName, a, nsnames, nsvalues);
nsnames.clear();
nsvalues.clear();
e->setActualString(in->lastString());
in->resetLastData();
eventList.append(e);
in->pause(true);
}
else {
QDomElement e = doc->createElementNS(namespaceURI, qName);
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
bool have;
if(!uri.isEmpty()) {
have = e.hasAttributeNS(uri, ln);
if(qt_bug_have)
have = !have;
}
else
have = e.hasAttribute(ln);
if(!have)
e.setAttributeNS(uri, atts.qName(n), atts.value(n));
}
if(depth == 1) {
elem = e;
current = e;
}
else {
current.appendChild(e);
current = e;
}
}
++depth;
return true;
}
示例3: sendStreamError
void BasicProtocol::sendStreamError(int cond, const QString &text, const QDomElement &appSpec)
{
QDomElement se = doc.createElementNS(NS_ETHERX, "stream:error");
QDomElement err = doc.createElementNS(NS_STREAMS, streamCondToString(cond));
if(!otherHost.isEmpty())
err.appendChild(doc.createTextNode(otherHost));
se.appendChild(err);
if(!text.isEmpty()) {
QDomElement te = doc.createElementNS(NS_STREAMS, "text");
te.setAttributeNS(NS_XML, "xml:lang", "en");
te.appendChild(doc.createTextNode(text));
se.appendChild(te);
}
se.appendChild(appSpec);
writeElement(se, 100, false);
}
示例4: sipReleaseType
static PyObject *meth_QDomElement_setAttributeNS(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
const QString* a0;
int a0State = 0;
const QString* a1;
int a1State = 0;
const QString* a2;
int a2State = 0;
QDomElement *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1J1", &sipSelf, sipType_QDomElement, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, sipType_QString,&a2, &a2State))
{
sipCpp->setAttributeNS(*a0,*a1,*a2);
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);
sipReleaseType(const_cast<QString *>(a2),sipType_QString,a2State);
Py_INCREF(Py_None);
return Py_None;
}
}
{
const QString* a0;
int a0State = 0;
const QString* a1;
int a1State = 0;
qlonglong a2;
QDomElement *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1n", &sipSelf, sipType_QDomElement, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, &a2))
{
sipCpp->setAttributeNS(*a0,*a1,a2);
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);
Py_INCREF(Py_None);
return Py_None;
}
}
{
const QString* a0;
int a0State = 0;
const QString* a1;
int a1State = 0;
qulonglong a2;
QDomElement *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1o", &sipSelf, sipType_QDomElement, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, &a2))
{
sipCpp->setAttributeNS(*a0,*a1,a2);
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);
Py_INCREF(Py_None);
return Py_None;
}
}
{
const QString* a0;
int a0State = 0;
const QString* a1;
int a1State = 0;
double a2;
QDomElement *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1Xd", &sipSelf, sipType_QDomElement, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, &a2))
{
sipCpp->setAttributeNS(*a0,*a1,a2);
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);
Py_INCREF(Py_None);
return Py_None;
}
}
{
const QString* a0;
int a0State = 0;
const QString* a1;
int a1State = 0;
int a2;
QDomElement *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1i", &sipSelf, sipType_QDomElement, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, &a2))
{
sipCpp->setAttributeNS(*a0,*a1,a2);
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);
Py_INCREF(Py_None);
return Py_None;
}
}
//.........这里部分代码省略.........