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


C++ DOMElement::appendChild方法代码示例

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


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

示例1: addSegmentedParagraphToSection

int addSegmentedParagraphToSection(vector<string> par, DOMElement* sect, const char* pid){
  DOMElement* aPar = NULL;
  int sid = 1;
  aPar =
  (sect->getOwnerDocument())->createElement(XMLString::transcode("paragraph"));

  aPar->setAttribute(XMLString::transcode("id"),
                     XMLString::transcode(pid));

  if ( aPar != NULL ) {
    for (vector<string>::iterator it = par.begin(); it != par.end(); it++) {
      if (verbose) cerr << "s";
      DOMElement* aSent = NULL;
      DOMElement* aSentText = NULL;
      aSent = (sect->getOwnerDocument())->createElement(XMLString::transcode("sentence"));
      aSentText = (sect->getOwnerDocument())->createElement(XMLString::transcode("text"));
      if ( (aSent != NULL) && (aSentText != NULL) ) {
        aSentText->setTextContent(XMLString::transcode((*it).c_str()));
        aSent->appendChild(aSentText);
        aPar->appendChild(aSent);
        stringstream sentId;
        sentId << pid << _ID_PREFIX_SENTENCE << sid;
        aSent->setAttribute(XMLString::transcode("id"),
                            XMLString::transcode(sentId.str().c_str()));
        sid++;
      }
    }
    sect->appendChild(aPar);
  }
  if (verbose) cerr << " ";
  return sid-1;
}
开发者ID:lgwizme,项目名称:macaon,代码行数:32,代码来源:main.cpp

示例2: WriteEntity

void EntityXMLFileWriter::WriteEntity(World* world, EntityID entity)
{
    using namespace xercesc;
    DOMDocument* doc = m_DOMImplementation->createDocument(nullptr, X("Entity"), nullptr);
    DOMElement* root = doc->getDocumentElement();
    root->setAttribute(X("xmlns:xsi"), X("http://www.w3.org/2001/XMLSchema-instance"));
    root->setAttribute(X("xsi:noNamespaceSchemaLocation"), X("../Types/Entity.xsd"));
    root->setAttribute(X("xmlns:c"), X("components"));
    const std::string& name = world->GetName(entity);
    if (!name.empty()) {
        root->setAttribute(X("name"), X(name));
    }
    
    DOMElement* componentsElement = doc->createElement(X("Components"));
    root->appendChild(componentsElement);
    appentEntityComponents(componentsElement, world, entity);

    DOMElement* childrenElement = doc->createElement(X("Children"));
    root->appendChild(childrenElement);
    appendEntityChildren(childrenElement, world, entity);

    try {
        LocalFileFormatTarget* target = new LocalFileFormatTarget(X(m_FilePath.string()));
        DOMLSOutput* output = static_cast<DOMImplementationLS*>(m_DOMImplementation)->createLSOutput();
        output->setByteStream(target);
        m_DOMLSSerializer->write(doc, output);
        delete target;
    } catch (const std::runtime_error& e) {
        LOG_ERROR("Failed to save \"%s\": %s", m_FilePath.c_str(), e.what());
    }

    doc->release();
}
开发者ID:FakeShemp,项目名称:TacticalZ,代码行数:33,代码来源:EntityXMLFileWriter.cpp

示例3: stampDocument

// 2006/12/16
void stampDocument(DOMElement* root) {
  DOMElement* meta = NULL;
  DOMElement* macastamps = NULL;
  DOMElement* stamp = NULL;

  stamp = (root->getOwnerDocument())->createElement(XMLString::transcode("maca_stamp"));
  stamp->setAttribute(XMLString::transcode("module"),
                      XMLString::transcode(_INSTALLED_NAME_));
  stamp->setAttribute(XMLString::transcode("version"),
                      XMLString::transcode(_VERSION_));
  stamp->setAttribute(XMLString::transcode("timestamp"),
                      XMLString::transcode(getTimestamp().c_str()));

  DOMNodeList* metaList = root->getElementsByTagName(XMLString::transcode("meta"));
  if (metaList->getLength() == 0) { // NO meta Element
    meta = (root->getOwnerDocument())->createElement(XMLString::transcode("meta"));
    macastamps =
      (root->getOwnerDocument())->createElement(XMLString::transcode("maca_stamps"));
    meta->appendChild(macastamps);
    root->insertBefore(meta,root->getFirstChild());
  } else { // meta Element
    meta = (DOMElement*)metaList->item(0);
    DOMNodeList* macastampsList = 
      meta->getElementsByTagName(XMLString::transcode("maca_stamps"));
    if (macastampsList->getLength() == 0) { // NO macastamps Element
      macastamps =
        (root->getOwnerDocument())->createElement(XMLString::transcode("maca_stamps"));
      meta->appendChild(macastamps);
    } else { // macastamps Element
      macastamps = (DOMElement*)macastampsList->item(0);
    }
  }
  macastamps->appendChild(stamp);
}
开发者ID:lgwizme,项目名称:macaon,代码行数:35,代码来源:main.cpp

示例4: toXMLCommon

void EppResponseInfoFeeType::toXMLCommon( DOMDocument &doc, const DOMString &tag, DOMElement& inElement )
{
	EppCommandInfoFeeType::toXMLCommon(doc, tag, inElement);
	DOMElement* elm = NULL;

	if( NULL != this->fee )
	{
		for( unsigned int i = 0; i < fee->size(); i++ )
		{
			EppFeeFee* member = fee->elementAt(i);

			if( NULL != member )
			{
				elm = member->toXML(doc, "fee");

				if( NULL != elm )
				{
					inElement.appendChild(elm);
				}
			}
		}
	}

	if( this->fClass.length() > 0 )
	{
		elm = doc.createElement(XS("class"));
		elm->appendChild(doc.createTextNode(this->fClass));
		inElement.appendChild(elm);
	}
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:30,代码来源:EppResponseInfoFeeType.cpp

示例5: toXML

DOMElement* EppCommandCreateSecDns::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = EppUtil::createElementNS(doc, "secDNS", (tag.isNull()) ? "create" : tag, false, "-1.1");

	if( this->maxSigLife != -1 )
	{
		elm = doc.createElement(XS("maxSigLife"));
		char cBuffer[32];
		sprintf(cBuffer, "%d", this->maxSigLife);
		elm->appendChild(doc.createTextNode(XS(cBuffer)));
		body->appendChild(elm);
	}
	for( unsigned int i = 0; i < this->dsDataList->size(); i++ )
	{
		EppSecDnsDsData ds = dsDataList->elementAt(i);
		DOMElement* elm = ds.toXML(doc, "dsData");
		body->appendChild(elm);
	}
	if( this->keyDataPresent == true )
	{
		for( unsigned int i = 0; i < this->keyDataList->size(); i++ )
		{
			EppSecDnsKeyData kd = keyDataList->elementAt(i);
			DOMElement* elm = kd.toXML(doc, "keyData");
			body->appendChild(elm);
		}
	}
	return body;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:30,代码来源:EppCommandCreateSecDns.cpp

示例6: toXML

DOMElement* EppCommandInfoLaunchRegistration::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = EppUtil::createElementNS(doc, "launch", (tag.isNull()) ? "info" : tag, false, "-1.0");

	DOMAttr* attr = doc.createAttribute(XS("includeMark"));
	attr->setValue( ( this->_includeMark ) ? XS("true") : XS("false") );
	body->setAttributeNode(attr);

	if( this->_phase.phase().length() > 0 )
	{
		DOMElement* elm = this->_phase.toXML(doc, "phase");
		body->appendChild(elm);
	}
	if( this->_appId.isNotNull() )
	{
		if( this->_appId.length() > 0 )
		{
			elm = doc.createElement(XS("applicationID"));
			elm->appendChild(doc.createTextNode(this->_appId));
			body->appendChild(elm);
		}
	}
	return body;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:25,代码来源:EppCommandInfoLaunchRegistration.cpp

示例7: appendEntityChildren

void EntityXMLFileWriter::appendEntityChildren(xercesc::DOMElement* parentElement, const World* world, EntityID entity)
{
    using namespace xercesc;
    DOMDocument* doc = parentElement->getOwnerDocument();

    auto childrenRange = world->GetEntityChildren().equal_range(entity);
    for (auto it = childrenRange.first; it != childrenRange.second; ++it) {
        EntityID childEntity = it->second;

        DOMElement* entityElement = doc->createElement(X("Entity"));
        const std::string& name = world->GetName(childEntity);
        if (!name.empty()) {
            entityElement->setAttribute(X("name"), X(name));
        }
        parentElement->appendChild(entityElement);

        DOMElement* componentsElement = doc->createElement(X("Components"));
        entityElement->appendChild(componentsElement);
        appentEntityComponents(componentsElement, world, childEntity);

        DOMElement* childrenElement = doc->createElement(X("Children"));
        entityElement->appendChild(childrenElement);
        appendEntityChildren(childrenElement, world, childEntity);
    }
}
开发者ID:FakeShemp,项目名称:TacticalZ,代码行数:25,代码来源:EntityXMLFileWriter.cpp

示例8: toXML

DOMElement* EppTransactionId::toXML( DOMDocument& doc, const DOMString& tag, bool nsflag )
{
	DOMElement* body = doc.createElement(tag);
	DOMElement* elm;

	if( clTRID.isNotNull() )
	{
		if( nsflag == true )
		{
			elm = EppUtil::createElementNS(doc, "epp", "clTRID", false);
		}
		else
		{
			elm = doc.createElement(XS("clTRID"));
		}
		elm->appendChild(doc.createTextNode(clTRID));
		body->appendChild(elm);
	}
	if( svTRID.isNotNull() )
	{
		if( nsflag == true )
		{
			elm = EppUtil::createElementNS(doc, "epp", "svTRID", false);
		}
		else
		{
			elm = doc.createElement(XS("svTRID"));
		}
		elm->appendChild(doc.createTextNode(svTRID));
		body->appendChild(elm);
	}
	return body;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:33,代码来源:EppTransactionId.cpp

示例9: toXML

DOMElement* EppAuthInfo::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* body = doc.createElement(tag);
	DOMElement* elm;
	if( (type.isNotNull()) && type.equals(TYPE_PW) )
	{
		elm = doc.createElement(XS("pw"));
		body->appendChild(elm);
		if( roid.isNotNull() && roid.length() > 0 )
		{
			elm->setAttribute(XS("roid"), roid);
		}
		if( value.isNotNull() )
		{
			elm->appendChild(doc.createTextNode(value));
		}
	}
	else if( (type.isNotNull()) && type.equals(TYPE_EXT) )
	{
		elm = doc.createElement(XS("ext"));
		body->appendChild(elm);
	}

	return body;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:25,代码来源:EppAuthInfo.cpp

示例10: toXMLCommon

void EppCommandCheckFeeType::toXMLCommon( DOMDocument &doc, const DOMString &tag, DOMElement& inElement )
{
	DOMElement* elm = NULL;

	if( this->name.length() > 0 )
	{
		elm = doc.createElement(XS("name"));
		elm->appendChild(doc.createTextNode(this->name));
		inElement.appendChild(elm);
	}
	EppCommandInfoFeeType::toXMLCommon(doc, tag, inElement);
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:12,代码来源:EppCommandCheckFeeType.cpp

示例11: toXML

DOMElement* EppSecDnsKeyData::toXML( DOMDocument& doc, const DOMString& tag )
{
	char	    buf[32];
	DOMElement* elm;
	DOMElement* body = doc.createElement(tag);

	elm = doc.createElement(XS("flags"));
	(void) ::sprintf(buf, "%d", this->flags);
	elm->appendChild(doc.createTextNode(XS(buf)));
	body->appendChild(elm);

	elm = doc.createElement(XS("protocol"));
	(void) ::sprintf(buf, "%d", this->protocol);
	elm->appendChild(doc.createTextNode(XS(buf)));
	body->appendChild(elm);

	elm = doc.createElement(XS("alg"));
	(void) ::sprintf(buf, "%d", this->alg);
	elm->appendChild(doc.createTextNode(XS(buf)));
	body->appendChild(elm);

	if( this->public_key.isNotNull() )
	{
		elm = doc.createElement(XS("pubKey"));
		elm->appendChild(doc.createTextNode(this->public_key));
		body->appendChild(elm);
	}

	return body;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:30,代码来源:EppSecDnsKeyData.cpp

示例12:

DOMElement * DSIGKeyInfoValue::createBlankRSAKeyValue(const char * modulus,
													  const char * exponent) {

	// Set the strings

	m_modulus.sbStrcpyIn(modulus);
	m_exponent.sbStrcpyIn(exponent);

	// Set our type
	
	m_keyInfoType = KEYINFO_VALUE_RSA;

	// Create the DOM Structure

	safeBuffer str;
	DOMDocument *doc = mp_parentSignature->getParentDocument();
	safeBuffer prefix = mp_parentSignature->getDSIGNSPrefix();

	makeQName(str, prefix, "KeyValue");

	DOMElement *ret = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.sbStrToXMLCh());
	mp_valueNode = ret;

	makeQName(str, prefix, "RSAKeyValue");
	DOMElement * rsa = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.sbStrToXMLCh());
	ret->appendChild(doc->createTextNode(DSIGConstants::s_unicodeStrNL));
	ret->appendChild(rsa);
	rsa->appendChild(doc->createTextNode(DSIGConstants::s_unicodeStrNL));
	ret->appendChild(doc->createTextNode(DSIGConstants::s_unicodeStrNL));

	// Now create the value children

	makeQName(str, prefix, "Modulus");
	DOMElement * v = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.sbStrToXMLCh());
	mp_modulusTextNode = doc->createTextNode(MAKE_UNICODE_STRING(modulus));
	rsa->appendChild(v);
	rsa->appendChild(doc->createTextNode(DSIGConstants::s_unicodeStrNL));
	v->appendChild(mp_modulusTextNode);

	makeQName(str, prefix, "Exponent");
	v = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.sbStrToXMLCh());
	mp_exponentTextNode = doc->createTextNode(MAKE_UNICODE_STRING(exponent));
	rsa->appendChild(v);
	rsa->appendChild(doc->createTextNode(DSIGConstants::s_unicodeStrNL));
	v->appendChild(mp_exponentTextNode);

	return ret;

}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:49,代码来源:DSIGKeyInfoValue.cpp

示例13: encodeDName

DOMElement * DSIGKeyInfoName::createBlankKeyName(const XMLCh * name, bool isDName) {

	// Create the DOM Structure

	safeBuffer str;
	DOMDocument *doc = mp_env->getParentDocument();
	const XMLCh * prefix = mp_env->getDSIGNSPrefix();

	makeQName(str, prefix, "KeyName");

	DOMElement *ret = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
	mp_keyInfoDOMNode = ret;

	// Check whether to encode prior to adding
	if (isDName == true) {

		// Treat as a distinguished name

		mp_decodedDName = XMLString::replicate(name);
		XMLCh * encodedName = encodeDName(name);
		mp_keyNameTextNode = doc->createTextNode(encodedName);
		XSEC_RELEASE_XMLCH(encodedName);
	}

	else
		mp_keyNameTextNode = doc->createTextNode(name);

	ret->appendChild(mp_keyNameTextNode);

	mp_name = mp_keyNameTextNode->getNodeValue();

	return ret;

}
开发者ID:okean,项目名称:cpputils,代码行数:34,代码来源:DSIGKeyInfoName.cpp

示例14: setKeySize

void XENCEncryptionMethodImpl::setKeySize(int size) {

	// First map the int to an XMLCh string
	XMLCh sizeXMLCh[10];
	XMLString::binToText((unsigned int) size, sizeXMLCh, 9, 10);

	if (mp_keySizeTextNode == NULL) {

		// Get some setup values
		safeBuffer str;
		DOMDocument *doc = mp_env->getParentDocument();
		const XMLCh * prefix = mp_env->getXENCNSPrefix();

		makeQName(str, prefix, s_KeySize);

		DOMElement *e = doc->createElementNS(DSIGConstants::s_unicodeStrURIXENC, str.rawXMLChBuffer());

		mp_encryptionMethodElement->insertBefore(e, mp_encryptionMethodElement->getFirstChild());
		mp_env->doPrettyPrint(mp_encryptionMethodElement);

		e->appendChild(mp_keySizeTextNode = doc->createTextNode(sizeXMLCh));
	} 
	
	else {

		mp_keySizeTextNode->setNodeValue(sizeXMLCh);

	}

}
开发者ID:okean,项目名称:cpputils,代码行数:30,代码来源:XENCEncryptionMethodImpl.cpp

示例15: appendElementWithText

void appendElementWithText( DOMNode* cur, DOMNode* reply,
                            const char* name, const char* text,
                            int indentLevel, bool indent,
                            attrVect* attribute ) {

   MC2String indentStr( indentLevel*3, ' ' );
   indentStr.insert( 0, "\n" );   
   DOMDocument* doc = XMLTool::getOwner( reply );
   DOMElement* textElement = doc->createElement( X( name ) );
   if ( text != NULL ) {
      textElement->appendChild( doc->createTextNode( X( text ) ) );
   }

   if ( attribute != NULL ) {
      for ( uint32 i = 0 ; i < attribute->size() ; ++i ) {
         textElement->setAttribute( X( (*attribute)[ i ].first ), 
                                    X( (*attribute)[ i ].second ) );
      }
   }

   // Add textElement to cur
   if ( indent ) {
      cur->appendChild( doc->createTextNode( X( indentStr.c_str() ) ) );
   }
   cur->appendChild( textElement );
}
开发者ID:FlavioFalcao,项目名称:Wayfinder-Server,代码行数:26,代码来源:XMLServerElements.cpp


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