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


C++ QDomDocument::createElementNS方法代码示例

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


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

示例1: QStringLiteral

QDomElement QgsCurvePolygon::asGml2( QDomDocument &doc, int precision, const QString &ns, const AxisOrder axisOrder ) const
{
  // GML2 does not support curves
  QDomElement elemPolygon = doc.createElementNS( ns, QStringLiteral( "Polygon" ) );

  if ( isEmpty() )
    return elemPolygon;

  QDomElement elemOuterBoundaryIs = doc.createElementNS( ns, QStringLiteral( "outerBoundaryIs" ) );
  std::unique_ptr< QgsLineString > exteriorLineString( exteriorRing()->curveToLine() );
  QDomElement outerRing = exteriorLineString->asGml2( doc, precision, ns, axisOrder );
  outerRing.toElement().setTagName( QStringLiteral( "LinearRing" ) );
  elemOuterBoundaryIs.appendChild( outerRing );
  elemPolygon.appendChild( elemOuterBoundaryIs );
  std::unique_ptr< QgsLineString > interiorLineString;
  for ( int i = 0, n = numInteriorRings(); i < n; ++i )
  {
    QDomElement elemInnerBoundaryIs = doc.createElementNS( ns, QStringLiteral( "innerBoundaryIs" ) );
    interiorLineString.reset( interiorRing( i )->curveToLine() );
    QDomElement innerRing = interiorLineString->asGml2( doc, precision, ns, axisOrder );
    innerRing.toElement().setTagName( QStringLiteral( "LinearRing" ) );
    elemInnerBoundaryIs.appendChild( innerRing );
    elemPolygon.appendChild( elemInnerBoundaryIs );
  }
  return elemPolygon;
}
开发者ID:SrNetoChan,项目名称:Quantum-GIS,代码行数:26,代码来源:qgscurvepolygon.cpp

示例2: deleteFeatures

bool QgsWFSProvider::deleteFeatures( const QgsFeatureIds &id )
{
  if ( id.size() < 1 )
  {
    return true;
  }

  //find out typename from uri and strip namespace prefix
  QString tname = mShared->mURI.typeName();
  if ( tname.isNull() )
  {
    return false;
  }

  //create <Transaction> xml
  QDomDocument transactionDoc;
  QDomElement transactionElem = createTransactionElement( transactionDoc );
  transactionDoc.appendChild( transactionElem );
  //delete element
  QDomElement deleteElem = transactionDoc.createElementNS( QgsWFSConstants::WFS_NAMESPACE, "Delete" );
  deleteElem.setAttribute( "typeName", tname );
  QDomElement filterElem = transactionDoc.createElementNS( QgsWFSConstants::OGC_NAMESPACE, "Filter" );


  QgsFeatureIds::const_iterator idIt = id.constBegin();
  for ( ; idIt != id.constEnd(); ++idIt )
  {
    //find out feature id
    QString gmlid = mShared->findGmlId( *idIt );
    if ( gmlid.isEmpty() )
    {
      QgsDebugMsg( QString( "Cannot identify feature of id %1" ).arg( *idIt ) );
      continue;
    }
    QDomElement featureIdElem = transactionDoc.createElementNS( QgsWFSConstants::OGC_NAMESPACE, "FeatureId" );
    featureIdElem.setAttribute( "fid", gmlid );
    filterElem.appendChild( featureIdElem );
  }

  deleteElem.appendChild( filterElem );
  transactionElem.appendChild( deleteElem );

  QDomDocument serverResponse;
  bool success = sendTransactionDocument( transactionDoc, serverResponse );
  if ( !success )
  {
    return false;
  }

  if ( transactionSuccess( serverResponse ) )
  {
    mShared->deleteFeatures( id );
    return true;
  }
  else
  {
    handleException( serverResponse );
    return false;
  }
}
开发者ID:MrBenjaminLeb,项目名称:QGIS,代码行数:60,代码来源:qgswfsprovider.cpp

示例3: code

/**
	\brief Writes the error to XML

	This function creates an error element representing the error object.

	You need to provide the base namespace of the stream to which this stanza belongs to
	(probably by using stream.baseNS() function).
*/
QDomElement Stanza::Error::toXml(QDomDocument &doc, const QString &baseNS) const
{
	QDomElement errElem = doc.createElementNS(baseNS, "error");
	QDomElement t;

	// XMPP error
	QString stype = Private::errorTypeToString(type);
	if(stype.isEmpty())
		return errElem;
	QString scond = Private::errorCondToString(condition);
	if(scond.isEmpty())
		return errElem;

	errElem.setAttribute("type", stype);
	errElem.appendChild(t = doc.createElementNS(NS_STANZAS, scond));
	t.setAttribute("xmlns", NS_STANZAS);	// FIX-ME: this shouldn't be needed

	// old code
	int scode = code();
	if(scode)
		errElem.setAttribute("code", scode);

	// text
	if(!text.isEmpty()) {
		t = doc.createElementNS(NS_STANZAS, "text");
		t.setAttribute("xmlns", NS_STANZAS);	// FIX-ME: this shouldn't be needed
		t.appendChild(doc.createTextNode(text));
		errElem.appendChild(t);
	}

	// application specific
	errElem.appendChild(appSpec);

	return errElem;
}
开发者ID:AlekSi,项目名称:Jabbin,代码行数:43,代码来源:xmpp_stanza.cpp

示例4: setSOAPWithAttachments

int QgsSOAPRequestHandler::setSOAPWithAttachments( QImage* img )
{
  QgsDebugMsg( "Entering." );
  //create response xml document
  QDomDocument xmlResponse; //response xml, save this into mimeString
  QDomElement envelopeElement = xmlResponse.createElementNS( "http://schemas.xmlsoap.org/soap/envelope/", "Envelope" );
  xmlResponse.appendChild( envelopeElement );
  QDomElement bodyElement = xmlResponse.createElementNS( "http://schemas.xmlsoap.org/soap/envelope/", "Body" );
  envelopeElement.appendChild( bodyElement );
  QDomElement getMapResponseElement = xmlResponse.createElementNS( "http://www.eu-orchestra.org/services/ms", "getMapResponse" );
  bodyElement.appendChild( getMapResponseElement );
  QDomElement returnElement = xmlResponse.createElementNS( "http://www.eu-orchestra.org/services/ms", "return" );
  returnElement.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
  returnElement.setAttribute( "xsi:type", "OA_ImageDocument" );
  returnElement.setAttribute( "href", "[email protected]" );
  getMapResponseElement.appendChild( returnElement );

  //create image buffer
  QByteArray ba;
  QBuffer buffer( &ba );
  buffer.open( QIODevice::WriteOnly );
  img->save( &buffer, mFormat.toLocal8Bit().data(), -1 ); // writes image into ba

  QByteArray xmlByteArray = xmlResponse.toString().toLocal8Bit();

  // Set headers
  setHeader( "MIME-Version", "1.0" );
  setHeader( "Content-Type", "Multipart/Related; boundary=\"MIME_boundary\"; type=\"text/xml\"; start=\"<[email protected]>\"" );
  // Start body
  appendBody( "--MIME_boundary\r\n" );
  appendBody( "Content-Type: text/xml\n" );
  appendBody( "Content-ID: <[email protected]>\n" );
  appendBody( "\n" );
  appendBody( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
  appendBody( xmlByteArray );
  appendBody( "\n" );
  appendBody( "\r\n" );
  appendBody( "--MIME_boundary\r\n" );
  if ( mFormat == "JPG" )
  {
    appendBody( "Content-Type: image/jpg\n" );
  }
  else if ( mFormat == "PNG" )
  {
    appendBody( "Content-Type: image/png\n" );
  }
  appendBody( "Content-Transfer-Encoding: binary\n" );
  appendBody( "Content-ID: <[email protected]>\n" );
  appendBody( "\n" );
  appendBody( ba );
  appendBody( "\r\n" );
  appendBody( "--MIME_boundary\r\n" );

  return 0;
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:55,代码来源:qgssoaprequesthandler.cpp

示例5: toSvg

QDomElement PhotoItem::toSvg(QDomDocument & document) const
{
    QDomElement result = AbstractPhoto::toSvg(document);
    result.setAttribute("class", "PhotoItem");

    // 'defs' tag
    QDomElement defs = document.createElement("defs");
    defs.setAttribute("class", "data");
    result.appendChild(defs);

    // 'defs'-> pfe:'data'
    QDomElement appNS = document.createElementNS(KIPIPhotoLayoutsEditor::uri(), "data");
    appNS.setPrefix(KIPIPhotoLayoutsEditor::name());
    defs.appendChild(appNS);

    if (!m_image_path.isEmpty())
    {
        // 'defs'-> pfe:'data' ->'path'
        QDomElement path = KIPIPhotoLayoutsEditor::pathToSvg(m_image_path, document);
        path.setAttribute("class", "m_image_path");
        path.setPrefix(KIPIPhotoLayoutsEditor::name());
        appNS.appendChild(path);
    }

    QDomElement image = document.createElementNS(KIPIPhotoLayoutsEditor::uri(), "image");
    appNS.appendChild(image);
    // Saving image data
    if (!PLEConfigSkeleton::embedImagesData())
    {
        int result = KMessageBox::questionYesNo(0,
                                                i18n("Do you want to embed images data?\n"
                                                        "Remember that when you move or rename image files on your disk or the storage device become unavailable, those images become unavailable for %1 "
                                                        "and this layout might become broken.", KApplication::applicationName()),
                                                i18n("Saving: %1", this->name()),
                                                KStandardGuiItem::yes(),
                                                KStandardGuiItem::no(),
                                                PLEConfigSkeleton::self()->config()->name());
        if (result == KMessageBox::Yes)
            PLEConfigSkeleton::setEmbedImagesData(true);
    }

    if ( (PLEConfigSkeleton::embedImagesData() && !d->pixmap().isNull()) || !d->fileUrl().isValid())
    {
        QByteArray byteArray;
        QBuffer buffer(&byteArray);
        d->pixmap().save(&buffer, "PNG");
        image.appendChild( document.createTextNode( QString(byteArray.toBase64()) ) );
    }

    // Saving image path
    if (d->fileUrl().isValid())
        image.setAttribute("src", d->fileUrl().url());

    return result;
}
开发者ID:coder89,项目名称:PhotoLayoutsEditor,代码行数:55,代码来源:PhotoItem.cpp

示例6: QStringLiteral

QDomElement QgsGeometryCollection::asGml3( QDomDocument &doc, int precision, const QString &ns, const QgsAbstractGeometry::AxisOrder axisOrder ) const
{
  QDomElement elemMultiGeometry = doc.createElementNS( ns, QStringLiteral( "MultiGeometry" ) );
  for ( const QgsAbstractGeometry *geom : mGeometries )
  {
    QDomElement elemGeometryMember = doc.createElementNS( ns, QStringLiteral( "geometryMember" ) );
    elemGeometryMember.appendChild( geom->asGml3( doc, precision, ns, axisOrder ) );
    elemMultiGeometry.appendChild( elemGeometryMember );
  }
  return elemMultiGeometry;
}
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:11,代码来源:qgsgeometrycollection.cpp

示例7: points

QDomElement QgsCircularString::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
  QgsPointSequence pts;
  points( pts );

  QDomElement elemCurve = doc.createElementNS( ns, QStringLiteral( "Curve" ) );
  QDomElement elemSegments = doc.createElementNS( ns, QStringLiteral( "segments" ) );
  QDomElement elemArcString = doc.createElementNS( ns, QStringLiteral( "ArcString" ) );
  elemArcString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
  elemSegments.appendChild( elemArcString );
  elemCurve.appendChild( elemSegments );
  return elemCurve;
}
开发者ID:cayetanobv,项目名称:QGIS,代码行数:13,代码来源:qgscircularstring.cpp

示例8: points

QDomElement QgsLineStringV2::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
  QList<QgsPointV2> pts;
  points( pts );

  QDomElement elemCurve = doc.createElementNS( ns, "Curve" );
  QDomElement elemSegments = doc.createElementNS( ns, "segments" );
  QDomElement elemArcString = doc.createElementNS( ns, "LineStringSegment" );
  elemArcString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
  elemSegments.appendChild( elemArcString );
  elemCurve.appendChild( elemSegments );

  return elemCurve;
}
开发者ID:saberraz,项目名称:QGIS,代码行数:14,代码来源:qgslinestringv2.cpp

示例9: QStringLiteral

QDomElement QgsMultiSurface::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
  QDomElement elemMultiSurface = doc.createElementNS( ns, QStringLiteral( "MultiSurface" ) );
  for ( const QgsAbstractGeometry *geom : mGeometries )
  {
    if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
    {
      QDomElement elemSurfaceMember = doc.createElementNS( ns, QStringLiteral( "surfaceMember" ) );
      elemSurfaceMember.appendChild( geom->asGML3( doc, precision, ns ) );
      elemMultiSurface.appendChild( elemSurfaceMember );
    }
  }

  return elemMultiSurface;
}
开发者ID:giohappy,项目名称:QGIS,代码行数:15,代码来源:qgsmultisurface.cpp

示例10: QStringLiteral

QDomElement QgsMultiPointV2::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
  QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) );
  Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
  {
    if ( dynamic_cast<const QgsPointV2 *>( geom ) )
    {
      QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral( "pointMember" ) );
      elemPointMember.appendChild( geom->asGML3( doc, precision, ns ) );
      elemMultiPoint.appendChild( elemPointMember );
    }
  }

  return elemMultiPoint;
}
开发者ID:cayetanobv,项目名称:QGIS,代码行数:15,代码来源:qgsmultipoint.cpp

示例11:

QDomElement QgsMultiPolygonV2::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
    QDomElement elemMultiSurface = doc.createElementNS( ns, "MultiPolygon" );
    Q_FOREACH ( const QgsAbstractGeometryV2 *geom, mGeometries )
    {
        if ( dynamic_cast<const QgsPolygonV2*>( geom ) )
        {
            QDomElement elemSurfaceMember = doc.createElementNS( ns, "polygonMember" );
            elemSurfaceMember.appendChild( geom->asGML3( doc, precision, ns ) );
            elemMultiSurface.appendChild( elemSurfaceMember );
        }
    }

    return elemMultiSurface;
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例12: write

bool XmlNotation::write(const std::vector<Moves> &mv)
{
    QDomDocument doc;

    auto proc = doc.createProcessingInstruction(
            u8"xml", u8"version=\"1.0\" encoding=\"utf-8\"");
    doc.appendChild(proc);

    auto cAuthors = doc.createComment(fromU8Str(impl::comment));
    doc.appendChild(cAuthors), doc.appendChild(doc.createTextNode("\n"));

    auto eRoot = doc.createElementNS(fromU8Str(impl::xmlns),
                                     fromU8Str(impl::eRoot));
    doc.appendChild(eRoot);

    for (auto &i : mv) {
        auto eTurn = doc.createElement(fromU8Str(impl::eTurn));
        eRoot.appendChild(eTurn);

        eTurn.setAttribute(fromU8Str(impl::aWhite),
            QString::fromStdString(i.white_move.to_string()));

        eTurn.setAttribute(fromU8Str(impl::aBlack),
            QString::fromStdString(i.black_move.to_string()));
    }

    QByteArray raw = doc.toByteArray(4);

    std::ofstream f(_pImpl->fileName,
                    std::ios_base::binary |
                    std::ios_base::trunc);
    f.write(raw.data(), raw.count());

    return true;
}
开发者ID:zcsevcik,项目名称:edu,代码行数:35,代码来源:XmlNotation.cpp

示例13: createPolygonElem

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

示例14: soapPrefix

void SoapBinding::Header::saveXML(ParserContext *context, QDomDocument &document, QDomElement &parent) const
{
    QDomElement element = document.createElementNS(soapStandardNamespace, soapPrefix(context) + QLatin1String("header"));
    parent.appendChild(element);

    if (!mMessage.isEmpty()) {
        element.setAttribute(QLatin1String("message"), mMessage.qname());
    } else {
        context->messageHandler()->warning(QLatin1String("SoapBinding::Header: 'message' required"));
    }

    if (!mPart.isEmpty()) {
        element.setAttribute(QLatin1String("part"), mPart);
    } else {
        context->messageHandler()->warning(QLatin1String("SoapBinding::Header: 'part' required"));
    }

#if 0
    if (!mEncodingStyle.isEmpty()) {
        element.setAttribute("encodingStyle", mEncodingStyle);
    }
#endif
    if (!mNameSpace.isEmpty()) {
        element.setAttribute(QLatin1String("namespace"), mNameSpace);
    }

    if (mUse == LiteralUse) {
        element.setAttribute(QLatin1String("use"), QLatin1String("literal"));
    } else {
        element.setAttribute(QLatin1String("use"), QLatin1String("encoded"));
    }

    mHeaderFault.saveXML(context, document, element);
}
开发者ID:Augus-Wang,项目名称:KDSoap,代码行数:34,代码来源:soapbinding.cpp

示例15: removeSession

void WbManager::removeSession(const QString &session) {
	WbDlg* d;
	for(int i = 0; i < dialogs_.size(); i++) {
		// does the session match?
		if(dialogs_.at(i)->session() == session) {
			d = dialogs_.takeAt(i);

			QDomDocument doc;
			QDomElement wb = doc.createElementNS("http://jabber.org/protocol/svgwb", "wb");
			wb.setAttribute("session", session);
			QDomElement protocol = doc.createElement("protocol");
			protocol.appendChild(doc.createElement("left-session"));
			wb.appendChild(protocol);
			sendMessage(wb, d->target(), d->groupChat());
			break;
		}
	}
	if(d) {
		if(negotiations_.contains(session)) {
			sendAbortNegotiation(session, negotiations_[session]->peer, d->groupChat());
			negotiations_.remove(session);
		}
		// FIXME: Delete the dialog
		d->setAttribute(Qt::WA_DeleteOnClose);
		d->close();
//		d->deleteLater();

	}
}
开发者ID:sapo,项目名称:sapo-messenger-for-mac,代码行数:29,代码来源:wbmanager.cpp


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