Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
// 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);
}
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);
	}
}
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;
}
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;
}
Exemplo n.º 7
0
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);
    }
}
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;
}
Exemplo n.º 9
0
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;
}
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);
}
Exemplo n.º 11
0
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;
}
Exemplo n.º 12
0
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;

}
Exemplo n.º 13
0
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;

}
Exemplo n.º 14
0
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);

	}

}
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 );
}
Exemplo n.º 16
0
Arquivo: XCube.cpp Projeto: mydw/mydw
bool XCube::wrapXML(xercesc::DOMDocument *doc,xercesc::DOMElement *tempElem)
{
	DOMElement *cubeElem = doc->createElement(XMLString::transcode("Cube"));

	if(this->_name != "")
		cubeElem->setAttribute(XMLString::transcode("name"),XMLString::transcode(this->_name.c_str()));
	if(this->_fact != "")
		cubeElem->setAttribute(XMLString::transcode("tablename"),XMLString::transcode(this->_fact.c_str()));

	cubeElem->appendChild(tempElem);

	XSchema *tempschema = this->getSchema();
	
	DOMElement* schemaElem = doc->getDocumentElement();//create root
	
		
	if(DataSource *tempDS = tempschema->getDataSource())
	{				
			schemaElem -> appendChild(tempDS->recursiveXML(doc));
	}
	schemaElem -> appendChild(cubeElem);
	return true;
		

}
Exemplo n.º 17
0
int ModelicaXML::serializeEachMoFileInDirectory(char *directoryName)
{
  typedef std::string mstring;
  mstring filename;
  l_list dirList;
  getDirectoryStructure(directoryName, dirList);
  std::list<char*>::const_iterator it;
  for(it=dirList.begin(); it!=dirList.end(); ++it)
  {
    l_list fileList;
    getFileList(*it, fileList, "*.mo");
    if (fileList.size()) fileList = sortMoFiles(fileList);
    cout << "Found: " << fileList.size() << " *.mo files in directory: " << *it  << endl;
    if (!fileList.size()) { continue; }
    std::list<char*>::const_iterator itFileList;
    for(itFileList=fileList.begin(); itFileList!=fileList.end(); ++itFileList)
    {
      filename = mstring(*itFileList);
      cout << " [" << filename << "]" << endl;
      DOMElement* pModelicaXML = createModelicaXMLDOMElement(filename.c_str());
      // if is not NULL append it to the <modelica></modelica> element
      if (pModelicaXML) pRootElementModelica->appendChild(pModelicaXML);
      // vomit the current XML Document to file
      std::string xmlFile(filename.c_str());
      xmlFile += ".xml";
      serializeXMLDocumentToFile(xmlFile);
      if (pModelicaXML) pRootElementModelica->removeChild(pModelicaXML);
    }
    if (fileList.size()) cout << endl;
  }
  return 0;
}
Exemplo n.º 18
0
void XercesUpdateFactory::applyReplaceElementContent(const PendingUpdate &update, DynamicContext *context)
{
  const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
  DOMElement *domnode = (DOMElement*)nodeImpl->getDOMNode();

  // 1. For each node $C that is a child of $target, the parent property of $C is set to empty.
  DOMNode *child = domnode->getFirstChild();
  while(child != 0) {
    forDeletion_.insert(child);
    child = child->getNextSibling();
  }

  const XMLCh *value = update.getValue().first()->asString(context);
  if(value != 0 && *value != 0) {
    // 2. The parent property of $text is set to $target.
    // 3a. children is set to consist exclusively of $text. If $text is an empty sequence, then $target has
    //     no children.
    // 3b. typed-value and string-value are set to the content property of $text. If $text is an empty sequence,
    //     then typed-value is an empty sequence and string-value is an empty string.
    domnode->appendChild(domnode->getOwnerDocument()->createTextNode(value));
  }

  // 3c. upd:removeType($target) is invoked.
  removeType(domnode);

  addToPutSet(update.getTarget(), &update, context);
}
Exemplo n.º 19
0
DOMElement * DSIGTransformXPath::createBlankTransform(DOMDocument * parentDoc) {

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

	prefix = mp_env->getDSIGNSPrefix();
	
	// Create the transform node
	makeQName(str, prefix, "Transform");
	ret = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
	ret->setAttributeNS(NULL,DSIGConstants::s_unicodeStrAlgorithm, DSIGConstants::s_unicodeStrURIXPATH);
	
	// Create the XPath element
	
	makeQName(str, prefix, "XPath");
	mp_xpathNode = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
	mp_exprTextNode = doc->createTextNode(MAKE_UNICODE_STRING(""));
	ret->appendChild(mp_xpathNode);
	mp_xpathNode->appendChild(mp_exprTextNode);

	mp_txfmNode = ret;

	return ret;

}
Exemplo n.º 20
0
Arquivo: XCube.cpp Projeto: mydw/mydw
xercesc::DOMElement *XCube::recursiveXML(xercesc::DOMDocument* doc)
{
	DOMElement *cubeElem = doc->createElement(XMLString::transcode("Cube"));

	if(this->_name != "")
		cubeElem->setAttribute(XMLString::transcode("name"),XMLString::transcode(this->_name.c_str()));
	if(this->_fact != "")
		cubeElem->setAttribute(XMLString::transcode("tablename"),XMLString::transcode(this->_fact.c_str()));

	if(this->_dimensions.size() > 0)
	{
		Dimension *tempdimension;
		for(int i = 0;i < this->_dimensions.size() ;i++)
		{
			tempdimension = this->getDimension(_dimensions[i]->getName());
			cubeElem->appendChild(tempdimension->recursiveXML(doc));

		}

	}

	if(this->_measures.size() > 0)
	{
		Measure *tempMeasures;
		for(int i = 0;i < this->_measures.size() ;i++)
		{
			tempMeasures = this->getMeasure(_measures[i]->getName());
			cubeElem->appendChild(tempMeasures->recursiveXML(doc));

		}

	}

	if(this->_calcmembers.size() > 0)
	{
		calcMember *tempCalcmember;
		for(int i = 0;i < this->_calcmembers.size() ;i++)
		{
			tempCalcmember = this->getCalMember(_calcmembers[i]->getName());
			cubeElem->appendChild(tempCalcmember->recursiveXML(doc));

		}

	}

	return cubeElem;
}
Exemplo n.º 21
0
// 2006/12/16
void handleFile(char* filein, char* fileout, int mode)
{
  if (mode==_TXT2TXTMODE) {
    int result;
    if (filein == NULL) {
      if (fileout == NULL) result = seg->segmentStream(cin,cout);
      else {
        ofstream* fout = new ofstream(fileout);
        result = seg->segmentStream(cin,*fout);
        fout->close();
      }
    } else {
      ifstream* fin = new ifstream(filein);
      ofstream* fout = new ofstream(fileout);
      result = seg->segmentStream(*fin,*fout);
      fin->close();
      fout->close();
    } 
    // BROKEN, result is false 2006/11/07
    //if (verbose) 
    //  cerr << "> Segmented in " << result << " sentences." << endl;
  } 
  else if (mode==_TXT2XMLMODE) {

    DOMDocument* out = xmlInterface->createDocument("document");
    DOMElement* root = out->getDocumentElement();
    if (filein != NULL)
      root->setAttribute(XMLString::transcode("filename"),
                         XMLString::transcode(filein));
    DOMElement* contents = out->createElement(XMLString::transcode("content"));
    DOMElement* body = out->createElement(XMLString::transcode("body"));
    DOMElement* section = out->createElement(XMLString::transcode("section"));
    section->setAttribute(XMLString::transcode("analyze"),
                          XMLString::transcode("yes"));
    DOMText* text = 
      out->createTextNode(XMLString::transcode(getFileContents(filein).c_str()));
    section->appendChild(text);
    body->appendChild(section);
    contents->appendChild(body);
    root->appendChild(contents);
    handleDocument(out,fileout);
  } 
  else if  (mode==_XML2XMLMODE) {
    handleDocument(xmlInterface->parse(filein),fileout);
  }
}
Exemplo n.º 22
0
void DomSerializer::AddString(const char* key, CStdString& value)
{
	DOMElement*  newElem = m_document->createElement(XStr(key).unicodeForm());
	m_node->appendChild(newElem);

	DOMText*    newText = m_document->createTextNode(XStr((PCSTR)value).unicodeForm());
	newElem->appendChild(newText);
}
DOMElement* EppCommandInfoSvcsub::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = EppUtil::createElementNS(doc, "svcsub", tag);

	if( id.isNotNull() )
	{
		elm = doc.createElement(XS("id"));
		elm->appendChild(doc.createTextNode(id));
		body->appendChild(elm);
	}
	if( service.isNotNull() )
	{
		elm = doc.createElement(XS("service"));
		elm->appendChild(doc.createTextNode(service));
		body->appendChild(elm);
	}
	if( userid.isNotNull() )
	{
		elm = doc.createElement(XS("userid"));
		elm->appendChild(doc.createTextNode(userid));
		body->appendChild(elm);
	}
	if( authInfo != null )
	{
		body->appendChild(authInfo->toXML(doc, "authInfo"));
	}

	return toXMLCommon(doc, tag, *body);
}
Exemplo n.º 24
0
DOMElement* EppCreds::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* body = doc.createElement(tag);
	DOMElement* elm;

	if( clID.isNotNull() )
	{
		elm = doc.createElement(XS("clID"));
		elm->appendChild(doc.createTextNode(clID));
		body->appendChild(elm);
	}
	if( pw.isNotNull() )
	{
		elm = doc.createElement(XS("pw"));
		elm->appendChild(doc.createTextNode(pw));
		body->appendChild(elm);
	}
	if( newPW.isNotNull() )
	{
		elm = doc.createElement(XS("newPW"));
		elm->appendChild(doc.createTextNode(newPW));
		body->appendChild(elm);
	}
	if( options != null )
	{
		body->appendChild(options->toXML(doc, "options"));
	}

	return body;
}
DOMElement* EppResponseDataRenewDomain::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = doc.createElement(tag);
	DOMElement* data = EppUtil::createElementNS(doc, "domain", "renData");
	body->appendChild(data);

	if( name.isNotNull() )
	{
		elm = doc.createElement(XS("name"));
		elm->appendChild(doc.createTextNode(name));
		data->appendChild(elm);
	}
	if( roid.isNotNull() )
	{
		elm = doc.createElement(XS("roid"));
		elm->appendChild(doc.createTextNode(roid));
		data->appendChild(elm);
	}
	if( exDate != 0 )
	{
		elm = doc.createElement(XS("exDate"));
		elm->appendChild(EppUtil::createTextNode(doc, exDate));
		data->appendChild(elm);
	}

	return body;
}
DOMElement* EppCommandTransferContact::toXMLPoll( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = EppUtil::createElementNS(doc, "contact", tag);

	if( id.isNotNull() )
	{
		elm = doc.createElement(XS("id"));
		elm->appendChild(doc.createTextNode(id));
		body->appendChild(elm);
	}
	if( authInfo != null )
	{
		body->appendChild(authInfo->toXML(doc, "authInfo"));
	}

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

    if( this->_type.length() > 0 )
    {
        DOMAttr* attr = doc.createAttribute(XS("type"));
        attr->setValue( this->_type);
        body->setAttributeNode(attr);
    }

    if ( this->_phase.phase().length() > 0 )
    {
        DOMElement* elm = this->_phase.toXML(doc, "phase");
        body->appendChild(elm);
    }

    if( (_signedMark.hasSMD()) )
    {   /*RAII*/
        DOMElement* elm = this->_signedMark.toXML(doc, "signedMark");
        body->appendChild(elm);
    }
    if( (_encSignedMark.hasSMD()) )
    {   /*RAII*/
        DOMElement* elm = this->_encSignedMark.toXML(doc, "encodedSignedMark");
        body->appendChild(elm);
    }
    if( this->_noticeID.length() > 0  )
    {
        elm = doc.createElement(XS("noticeID"));
        elm->appendChild(doc.createTextNode(this->_noticeID));
        body->appendChild(elm);
    }
    if( this->_notAfter.length() > 0  )
    {
        elm = doc.createElement(XS("notAfter"));
        elm->appendChild(doc.createTextNode(this->_notAfter));
        body->appendChild(elm);
    }
    if( this->_acceptedDate.length() > 0  )
    {
        elm = doc.createElement(XS("acceptedDate"));
        elm->appendChild(doc.createTextNode(this->_acceptedDate));
        body->appendChild(elm);
    }

    return body;
}
Exemplo n.º 28
0
DOMElement* EppCredsOptions::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* body = doc.createElement(tag);
	DOMElement* elm;

	if( version.isNotNull() )
	{
		elm = doc.createElement(XS("version"));
		elm->appendChild(doc.createTextNode(version));
		body->appendChild(elm);
	}
	if( lang.isNotNull() )
	{
		elm = doc.createElement(XS("lang"));
		elm->appendChild(doc.createTextNode(lang));
		body->appendChild(elm);
	}

	return body;
}
DOMElement* EppResponseDataCheckDomain::toXML( DOMDocument& doc, const DOMString& tag )
{
	//DOMElement* elm;
	DOMElement* body = doc.createElement(tag);
	DOMElement* data = EppUtil::createElementNS(doc, "domain", "chkData");

	body->appendChild(data);
	toXMLCommon(doc, *data, "name");

	return body;
}
Exemplo n.º 30
0
/* NOTE: need to keep _type field in consideration as attribute type/entitlement depends on it.*/
DOMElement* EppMarkHolder::toXML(DOMDocument &doc, const DOMString &tag)
{
	DOMString attr_name = "type";
	DOMElement* elm;
	DOMElement* body = doc.createElement(tag);

	if( this->_type == EPPMARK_HOLDER )
	{
		attr_name = "entitlement";
	}
	DOMAttr* attr = doc.createAttribute(attr_name);
	attr->setValue( this->_addParam );
	body->setAttributeNode(attr);

	if( this->_name.length() > 0 )
	{
		elm = doc.createElement(XS("name"));
		elm->appendChild(doc.createTextNode(this->_name));
		body->appendChild(elm);
	}
	if( this->_org.length() > 0 )
	{
		elm = doc.createElement(XS("org"));
		elm->appendChild(doc.createTextNode(this->_org));
		body->appendChild(elm);
	}
	body->appendChild(this->_addr.toXML(doc, "addr"));

	if( this->_voice.getNumber().length() > 0 )
	{
		elm = this->_voice.toXML(doc, "voice");
		body->appendChild(elm);
	}
	if( this->_fax.getNumber().length() > 0 )
	{
		elm = this->_fax.toXML(doc, "fax");
		body->appendChild(elm);
	}
	if( this->_email.length() > 0 )
	{
		elm = doc.createElement(XS("email"));
		elm->appendChild(doc.createTextNode(this->_email));
		body->appendChild(elm);
	}
	return body;
}