Ejemplo n.º 1
0
	/*this method is only used for setting special character */
	XmlNode addTextForAcctOwner(char *value) {
		XMLTransService::Codes failReason;
		XMLCh* xmlChars = new XMLCh[512];
		unsigned int eaten = 0;
		unsigned char* charSizes = new unsigned char[512];

		if (value != NULL) {

			try {
				XMLTranscoder* t =
						XMLPlatformUtils::fgTransService->makeNewTranscoderFor(
								"UTF-8", failReason, 16 * 1024);
				t->transcodeFrom((XMLByte*) value, 512, xmlChars, 512, eaten,
						charSizes);
				node->setTextContent(xmlChars);
			} catch (...) {
				XMLCh *tempStr = XMLString::transcode(value);
				node->setTextContent(tempStr);
				XMLString::release(&tempStr);
			}
		}
		delete xmlChars;
		delete charSizes;
		return XmlNode(node,doc);
	}
Ejemplo n.º 2
0
/*DR-2-023-245 */
void update_sepa_CdtTrn_header_info(int numberOfRecords, Arb_numeric *credit_amt) {
	DOMNodeList *headerChildList = cdtTrnheader->getChildNodes();
	DOMNode* node = NULL;
	char temp[64] = { 0 };
	double e_amount;
	XMLCh *tempStr = NULL;
	int counter = 0;
	Arb_numeric out_num = ARB_NUMERIC_ZERO;
	for (size_t i = 0; i < headerChildList->getLength(); ++i) {
		node = headerChildList->item(i);
		tempStr = XMLString::transcode("NbOfTxs");
		if (XMLString::equals(node->getNodeName(), tempStr)) {
			XMLString::release(&tempStr);
			sprintf(temp, "%d", numberOfRecords);
			tempStr = XMLString::transcode(temp);
			node->setTextContent(tempStr);
			XMLString::release(&tempStr);
			counter++;
		
		}
		tempStr = XMLString::transcode("CtrlSum");
		if (XMLString::equals(node->getNodeName(), tempStr)) {
			XMLString::release(&tempStr);
			arb_num_rate(&out_num, credit_amt, 1, (gEur_impl_decimal - 2),
					gEur_round_method);
			arb_numeric_to_double(&out_num, &e_amount);

			sprintf(temp, "%d.%02.0f", (int) e_amount / 100,
					fmod(e_amount, 100));
			tempStr = XMLString::transcode(temp);
			node->setTextContent(tempStr);
			XMLString::release(&tempStr);
			counter++;
		}

		if (counter == 2)
			break;

	}

}
Ejemplo n.º 3
0
void XmlElement::setText(const string& text) {
    assert(doc != NULL && "Attempt to create text on a root node");
    DOMNode* first = base->getFirstChild();
    bool found = false;
    while(first && !found) {
        if (first->getNodeType() == 3) {
            first->setTextContent(toUnicode(text));
            found = true;
        }
        first = first->getPreviousSibling();
    }
    if (!found) {
        DOMText* textNode = doc->createTextNode(toUnicode(text));
        base->appendChild(textNode);
    }
}
Ejemplo n.º 4
0
//
// set_element_value
//
void Utils::
set_element_value (xercesc::DOMElement * e,
                   const GAME::Xml::String & element,
                   const GAME::Xml::String & value)
{
  using xercesc::DOMNode;
  using xercesc::DOMNodeList;
  using xercesc::DOMDocument;

  // There should be only 1 <name> tag in the list.
  GAME::Xml::String nodename;
  DOMNode * node = 0;
  DOMNodeList * list = e->getChildNodes ();
  size_t len = list->getLength ();

  for (size_t i = 0; i < len; ++ i)
  {
    // Get the name of the next node.
    node = list->item (i);
    nodename.set (node->getNodeName (), false);

    if (nodename == element)
      break;

    // Reset the node.
    node = 0;
  }

  if (node == 0)
  {
    // We need to create the <name> element.
    DOMDocument * doc = e->getOwnerDocument ();
    node = doc->createElement (element);
    e->appendChild (node);
  }

  // Since there are no child nodes, we can just set the
  // text content to the name of the object.
  node->setTextContent (value);
}
Ejemplo n.º 5
0
void update_sepa_header_info(int *num_trans, int *num_closed,
		Arb_numeric *debit_amt, Arb_numeric *credit_amt) {
	int counter = 0;
	DOMNodeList *headerChildList = header->getChildNodes();
	DOMNode* node = NULL;
	char temp[64] = { 0 };
	char temp1[64] = { 0 };
	Arb_numeric out_num = ARB_NUMERIC_ZERO;
	double e_amount;
	XMLCh *tempStr = NULL;
	int n=2;
	for (std::map<string,PmtInf*>::iterator it=PmtInfMap.begin(); it!=PmtInfMap.end(); ++it)
	{
		PmtInf *p= it->second ;
		Arb_numeric * ctrlAmt=p->getCtrlSum();
		arb_numeric_to_string(ctrlAmt,temp1);
		format_amount(temp1,n);
	   sprintf(temp, "%s", temp1);
	   //sprintf(temp,"%f",p->getCtrlSum());
	   tempStr = XMLString::transcode(temp);
	   if(p->getCtrlSum_node()!=NULL)
       p->getCtrlSum_node()->setTextContent(tempStr);
	   sprintf(temp,"%d",p->getNbOftxs());
	   tempStr = XMLString::transcode(temp);
	   if(p->getNbOftxs_node()!=NULL)
	   p->getNbOftxs_node()->setTextContent(tempStr);
	   delete p;
	}
	PmtInfMap.clear();
	for (size_t i = 0; i < headerChildList->getLength(); ++i) {
		node = headerChildList->item(i);
		tempStr = XMLString::transcode("NbOfTxs");
		if (XMLString::equals(node->getNodeName(), tempStr)) {
			XMLString::release(&tempStr);
			sprintf(temp, "%d", *num_trans - *num_closed - gCdtTrnCounter);
			tempStr = XMLString::transcode(temp);
			node->setTextContent(tempStr);
			XMLString::release(&tempStr);
			counter++;
		}

		tempStr = XMLString::transcode("CtrlSum");
		if (XMLString::equals(node->getNodeName(), tempStr)) {
			XMLString::release(&tempStr);
			arb_num_rate(&out_num, debit_amt, 1, (gEur_impl_decimal - 2),
					gEur_round_method);
			arb_numeric_to_string(&out_num,temp1);
			format_amount(temp1,n);
			sprintf(temp, "%s", temp1);
//			arb_numeric_to_double(&out_num, &e_amount);

//			sprintf(temp, "%d.%02.0f", (int) e_amount / 100,
//					fmod(e_amount, 100));
			tempStr = XMLString::transcode(temp);
			node->setTextContent(tempStr);
			XMLString::release(&tempStr);
			counter++;
		}

		if (counter == 2)
			break;

	}

}