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


C++ DOMNode::getChildNodes方法代码示例

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


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

示例1: if

EppCommand * EppCommand::fromXML( const DOMNode& root )
{
	unsigned int i;
	EppCommand * cmd = null;
	DOMNode* command;
	bool found = false;

	DOMNodeList* list = root.getChildNodes();
	for( i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);
		DOMString name = node->getLocalName();
		if( name.isNull() )
		{
			name = node->getNodeName();
		}
		if( name.isNull() )
		{
			continue;
		}
		if( name.equals("command") )
		{
			command = node;
			found = true;
			break;
		}
	}

	if( found == false )
	{
		return null;
	}

	list = command->getChildNodes();
	for( i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);
		DOMString name = node->getLocalName();
		if( name.isNull() )
		{
			name = node->getNodeName();
		}
		if( name.isNull() )
		{
			continue;
		}
		if( name.equals("login") )
		{
			cmd = EppCommandLogin::fromXML(*node);
		}
		else if( name.equals("logout") )
		{
			cmd = EppCommandLogout::fromXML(*node);
		}
		else if( name.equals("poll") )
		{
			cmd = EppCommandPoll::fromXML(*node);
		}
		else if( name.equals("create") )
		{
			cmd = EppCommandCreate::fromXML(*node);
		}
		else if( name.equals("delete") )
		{
			cmd = EppCommandDelete::fromXML(*node);
		}
		else if( name.equals("info") )
		{
			cmd = EppCommandInfo::fromXML(*node);
		}
		else if( name.equals("check") )
		{
			cmd = EppCommandCheck::fromXML(*node);
		}
		else if( name.equals("renew") )
		{
			cmd = EppCommandRenew::fromXML(*node);
		}
		else if( name.equals("transfer") )
		{
			cmd = EppCommandTransfer::fromXML(*node);
		}
		else if( name.equals("update") )
		{
			cmd = EppCommandUpdate::fromXML(*node);
		}
		/*
		 * other commands
		 */
		if( cmd != null )
		{
			break;
		}
	}
	if( cmd == null )
	{
		return null;
	}
	for( i = 0; i < list->getLength(); i++ )
	{
//.........这里部分代码省略.........
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:101,代码来源:EppCommand.cpp

示例2: ParseDevices

bool CConfigParser::ParseDevices(DOMNodeList* deviceNodeList, ADeviceListener& configClass)
{
	ASSERT(deviceNodeList->getLength() >= 1);
	DOMNode* deviceNode = deviceNodeList->item(0);
	DOMNodeList* devices = deviceNode->getChildNodes();
	for(unsigned long idx = 0; idx < devices->getLength(); idx++)
	{
		DOMNode* currentDevice = devices->item(idx);
		wstring deviceNodeName = currentDevice->getNodeName();
		if(deviceNodeName.compare(L"#text") == 0)
			continue;
		wstring deviceName = currentDevice->getAttributes()->getNamedItem(L"name")->getNodeValue();
		//wstring deviceType = currentDevice->getAttributes()->getNamedItem(L"type")->getNodeValue();
		wstring deviceType = deviceNodeName;
		if(deviceType.compare(L"mouse") == 0)
		{
			configClass.AddDevice(deviceName, new CMouseProc());
		}
		else
		{
			CWin32SpaceNavigatorHIDCapture* deviceToAdd = new CWin32SpaceNavigatorHIDCapture();
			if(currentDevice->hasChildNodes())
			{
				if(!ParseHIDDeviceCommands(currentDevice->getChildNodes(), deviceToAdd))
					return false;
			}
			configClass.AddDevice(deviceName, deviceToAdd);
		}
	}
	return true;
}
开发者ID:rgeyer,项目名称:SpaceNavigatorHIDCapture,代码行数:31,代码来源:CConfigParser.cpp

示例3: ParseDeviceContexts

bool CConfigParser::ParseDeviceContexts(DOMNodeList* deviceContextNodes, ADeviceListener& configClass)
{
	ASSERT(deviceContextNodes->getLength() == 1);
	DOMNode* deviceContextNode = deviceContextNodes->item(0);
	DOMNodeList* deviceContexts = deviceContextNode->getChildNodes();
	for(unsigned long idx = 0; idx < deviceContexts->getLength(); idx++)
	{
		DOMNode* currentDeviceContext = deviceContexts->item(idx);
		wstring deviceContextNodeName = currentDeviceContext->getNodeName();
		if(deviceContextNodeName.compare(L"#text") == 0)
			continue;
		if(deviceContextNodeName.compare(L"#comment") == 0)
			continue;
		wstring deviceContextName = currentDeviceContext->getAttributes()->getNamedItem(L"name")->getNodeValue();
		wstring deviceName = currentDeviceContext->getAttributes()->getNamedItem(L"device")->getNodeValue();
		bool gestures = false;
		if(currentDeviceContext->getAttributes()->getNamedItem(L"gestures") != NULL)
			gestures = true;
		// Create the device context to add
		CDeviceContext* deviceContextToAdd = NULL;
		if(configClass.GetDevices()[deviceName]->GetType().compare("mouse") == 0)
			deviceContextToAdd = new CMouseDeviceContext(gestures, deviceName);
		else
			deviceContextToAdd = new CDeviceContext(gestures, deviceName);

		// Get the device contexts axis and buttons added
		if(currentDeviceContext->hasChildNodes())
		{
			unsigned char axeIdx = 0;
			DOMNodeList* children = currentDeviceContext->getChildNodes();
			unsigned long childCount = children->getLength();
			for(unsigned long idx = 0; idx < childCount; idx++)
			{
				DOMNode* childNode = children->item(idx);			
				wstring nodeName = childNode->getNodeName();

				if(nodeName.compare(L"axe") == 0)
				{
					ParseAxe(childNode, configClass.GetActions(), deviceContextToAdd, axeIdx);
					axeIdx++;
				}
				if(nodeName.compare(L"buttons") == 0)
					ParseButtons(childNode, configClass.GetActions(), deviceContextToAdd);
				if(nodeName.compare(L"gesture") == 0)
					ParseGesture(childNode, configClass.GetActions(), deviceContextToAdd);
			}
		}
		configClass.AddDeviceContext(deviceContextName, deviceContextToAdd);
		TRACE("Device Context <%S> is 0x%X\r\n", deviceContextName.c_str(), deviceContextToAdd);
	}
	return true;
}
开发者ID:rgeyer,项目名称:SpaceNavigatorHIDCapture,代码行数:52,代码来源:CConfigParser.cpp

示例4: HandlerBase

map<string, DatasetSpecification> Specifications::readDatasetIndex(string str){
  map<string, DatasetSpecification> result;
  XERCES_CPP_NAMESPACE_USE
  XMLPlatformUtils::Initialize();
  XercesDOMParser parser;
  parser.setValidationScheme(XercesDOMParser::Val_Always);
  HandlerBase errHandler;// = (ErrorHandler*) new HandlerBase();
  parser.setErrorHandler(&errHandler);
  parser.parse(str.c_str());
  DOMDocument * doc = parser.getDocument();
  DOMElement* elementRoot = doc->getDocumentElement();
  DOMNodeList *entries = 
    elementRoot->getElementsByTagName(XMLString::transcode("dataset"));
  
  cout << "Databases in index:\n";
  for(size_t i = 0; i < entries->getLength(); ++i){
    DOMNode *current = entries->item(i);
    DatasetSpecification dss;
    dss.name = XMLString::transcode(current->getAttributes()->
				    getNamedItem(XMLString::transcode("name"))->
				    getNodeValue());
    dss.root = XMLString::transcode(current->getAttributes()->
				    getNamedItem(XMLString::transcode("root"))->
				    getNodeValue());
    cout << "  name: " << dss.name << " root: " << dss.root << endl;
    DOMNodeList *categories = current->getChildNodes();
    for(size_t j = 0; j < categories->getLength(); ++j)
      if((string) XMLString::transcode(categories->item(j)->getNodeName()) ==
	 "category")
	dss.categories.push_back(XMLString::transcode(categories->item(j)->getTextContent()));
    result[dss.name] = dss;
  }
  return result;
}
开发者ID:jelmervdl,项目名称:vistool,代码行数:34,代码来源:dataset.cpp

示例5: ParseContexts

bool CConfigParser::ParseContexts(DOMNodeList* contextNodes, ADeviceListener& configClass)
{
	ASSERT(contextNodes->getLength() == 1);
	DOMNode* contextNode = contextNodes->item(0);
	DOMNodeList* contexts = contextNode->getChildNodes();
	for(unsigned long idx = 0; idx < contexts->getLength(); idx++)
	{
		DOMNode* currentContext = contexts->item(idx);
		wstring contextNodeName = currentContext->getNodeName();
		if(contextNodeName.compare(L"#text") == 0)
			continue;
		wstring contextName = currentContext->getAttributes()->getNamedItem(L"name")->getNodeValue();
		CContext* contextToAdd = new CContext();
		unsigned long attrLen = currentContext->getAttributes()->getLength();
		for(unsigned long attr = 0; attr < attrLen; attr++)
		{
			DOMNode* deviceContextAttr = currentContext->getAttributes()->item(attr);
			if(wcscmp(deviceContextAttr->getNodeName(), L"deviceContext") == 0)
			{
				wstring deviceContextName = deviceContextAttr->getNodeValue();
				CDeviceContext* deviceContext = configClass.GetDeviceContexts()[deviceContextName];
				IDeviceCapture* device = configClass.GetDevices()[deviceContext->GetDeviceName()];
				contextToAdd->AddDeviceContext(device, deviceContext);
			}
		}
		configClass.AddContext(contextName, contextToAdd);
	}
	return true;
}
开发者ID:rgeyer,项目名称:SpaceNavigatorHIDCapture,代码行数:29,代码来源:CConfigParser.cpp

示例6: create_CdtTrn_PmtInf_body

//DR-2-023-245  fill data with pmtinf field in XML
void create_CdtTrn_PmtInf_body(PmtInf *PmtOBj) {
	DOMNode *pmtInf =PmtOBj->getPmtInf_node();
	int counter = 0;
	DOMNodeList *pmtChildList = pmtInf->getChildNodes();
	DOMNode* node = NULL;
	char s[64] = { 0 };
	char ccy[4] = { 0 };
	char *temp = NULL;
	Arb_numeric out_num = ARB_NUMERIC_ZERO;
	double e_amount = 0.0;
	double s_amount = 0.0;
	XMLCh *tempStr = NULL;

	XmlNode pmtNode(pmtInf,cdtTrndoc);
	char endtoend[99]={0};
	sprintf(endtoend, "%02d%010d%03d%010d%03d%s", gTrans.tracking_id_serv,
			gTrans.tracking_id, gTrans.counter, gTrans.bill_ref_no,
			gTrans.bill_ref_resets, gTrans.sequence_type);
	
	arb_num_rate(&out_num,&gTrans.amount,1,(gEur_impl_decimal - 2),gEur_round_method);
        arb_numeric_to_double(&out_num,&e_amount);
        sprintf(s,"%d.%02.0f",(int)e_amount/100,fmod(e_amount,100));
	s_amount += atof(s); 
	sprintf(s, "%.2f", s_amount);
	sprintf(ccy,"%d",gTrans.currency_code);

	XmlNode cdtTrnTxInfNode = pmtNode.addChild("CdtTrfTxInf");
	XmlNode pmtIdNode = cdtTrnTxInfNode.addChild("PmtId");
	pmtIdNode.addChild("EndToEndId",endtoend);
	cdtTrnTxInfNode.addChild("Amt").addChild("InstdAmt",s).addAttribute("Ccy", ccy);
}
开发者ID:huilang22,项目名称:Projects,代码行数:32,代码来源:eft_cr_xml.cpp

示例7: selectSubmodule

DOMNode* Triggerconf::selectSubmodule (string modulename, string submodulename)
{
	DOMNode* currentModule = selectModule (modulename);

	if (currentModule == NULL) {
		setError ("invalid module: " + modulename);
		return NULL;
	}

	DOMNodeList* childs = currentModule->getChildNodes ();
	
	if (childs == NULL) {

		if (autocreate == false) {
			setError ("submodule " + modulename + " not found");
			return NULL; 
		} else {
			resetError ();
			createSubmodule (modulename, submodulename);
			return selectSubmodule (modulename, submodulename);
		}

	} // if (childs == NULL) 

	for (unsigned int i=0; i<childs->getLength (); i++) {
		
		DOMNode* node = childs->item (i);
		if (node == NULL || node->getNodeType () != DOMNode::ELEMENT_NODE) continue;
		
		char* xmlstring = XMLString::transcode (node->getNodeName ());

		if (((string) ELEMENT_SUBMODULE_NAME).compare (xmlstring) != 0) {
			XMLString::release (&xmlstring);
			continue;
		}

		XMLString::release (&xmlstring);

		if ((getAttributeValue (node, ATTRIBUTE_NAME)).compare (submodulename) == 0) {		
			resetError ();		
			return node;
		}

	} // for (unsigned int i=0; i<childs->getLength (); i++)

	if (autocreate == false) {
		setError ("submodule " + submodulename + " not found");
		return NULL;
	} else {
		resetError ();
		createSubmodule (modulename, submodulename);
		return selectSubmodule (modulename, submodulename);
	}
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:54,代码来源:triggerconf.cpp

示例8: fromXMLCommon

void EppResponseInfoFeeType::fromXMLCommon( const DOMNode& root, EppResponseInfoFeeType* data )
{
	if( NULL == data )
	{
		return;
	}

	EppCommandInfoFeeType::fromXMLCommon(root, data);

	DOMNodeList* list = root.getChildNodes();

	if( NULL == list )
	{
		return;
	}

	for( unsigned int i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);

		if( NULL == node )
		{
			continue;
		}

		DOMString name = node->getLocalName();

		if( name.isNull() )
		{
			name = node->getNodeName();
		}
		if( name.isNull() )
		{
			continue;
		}

		if( name.equals("fee") || name.equals("fee:fee") )
		{
			EppFeeFee* f = EppFeeFee::fromXML(*node);
			if( NULL != f )
			{
				data->addFee(f);
			}
			continue;
		}
		if( name.equals("class") || name.equals("fee:class") )
		{
			data->setFeeClass(EppUtil::getText(*node));
			continue;
		}

	}
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:53,代码来源:EppResponseInfoFeeType.cpp

示例9: getChildValue

/**
 *  Returns the value of a names child element
 *  @param element parent element
 *  @param name name of child element value is stored in
 *  @return the value of the child element with the given name or NULL if there are 0 or >1 elements with the given name
 */
char* getChildValue(DOMElement* element, const char* name) {
	DOMNode* child = getElement(element, name);
	if (child == NULL)
		return NULL;

	DOMNodeList* contentList = child->getChildNodes();
	if (contentList->getLength() != 1)
		return NULL;

	DOMNode* firstContent = contentList->item(0);
	if (firstContent == NULL)
		return NULL;

	return XMLString::transcode(firstContent->getNodeValue());
}
开发者ID:chazmatazz,项目名称:proto-mirror,代码行数:21,代码来源:xerces_bodies.cpp

示例10: selectConfigElement

DOMNode* Triggerconf::selectConfigElement (string modulename, string submodulename, string configname)
{
	DOMNode* currentSubmodule = selectSubmodule (modulename, submodulename);
	if (currentSubmodule == NULL) {
		setError ("invalid submodule " + submodulename + " in module " + modulename);
		return NULL;
	}

	DOMNodeList* childs = currentSubmodule->getChildNodes ();
	if (childs == NULL) {
		setError ("submodule " + submodulename + " in module " + modulename + " not found");
		return NULL;
	}

	for (unsigned int i=0; i<childs->getLength (); i++) {
		
		DOMNode* child = childs->item (i);
		if (child == NULL || child->getNodeType () != DOMNode::ELEMENT_NODE) continue;

		char* xmlstring = XMLString::transcode (child->getNodeName ());

		if (((string) ELEMENT_CONFIGITEM_NAME).compare (xmlstring) != 0) {
			XMLString::release (&xmlstring);		
			continue;
		}

		XMLString::release (&xmlstring);		

		if ((getAttributeValue (child, ATTRIBUTE_NAME)).compare (configname) == 0) {		
			resetError ();		
			return child;
		}

	} // for (unsigned int i=0; i<childs->getLength (); i++) 

	if (autocreate == false) {
		setError ("configelement " + configname + " not found");
		return NULL; 
	} else {
		resetError ();
		createConfigElement (modulename, submodulename, configname);
		return selectConfigElement (modulename, submodulename, configname);
	}
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:44,代码来源:triggerconf.cpp

示例11: fromXMLCommon

void EppCommandCheckFeeType::fromXMLCommon( const DOMNode& root, EppCommandCheckFeeType* data )
{
	if( NULL == data )
	{
		return;
	}

	EppCommandInfoFeeType::fromXMLCommon(root, data);

	DOMNodeList* list = root.getChildNodes();

	if( NULL == list )
	{
		return;
	}

	for( unsigned int i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);

		if( NULL == node )
		{
			continue;
		}

		DOMString name = node->getLocalName();

		if( name.isNull() )
		{
			name = node->getNodeName();
		}
		if( name.isNull() )
		{
			continue;
		}
		if( name.equals("name") || name.equals("fee:name") )
		{
			data->setName(EppUtil::getText(*node));
			continue;
		}
	}
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:42,代码来源:EppCommandCheckFeeType.cpp

示例12: getText

DOMString EppUtil::getText( const DOMNode &root )
{
	DOMNodeList* list = root.getChildNodes();
	if( list->getLength() == 0 )
	{
		return root.getNodeValue();
	}

	DOMString str = DOMString("");
	for( unsigned int i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);
		if( (node->getNodeType() == DOMNode::TEXT_NODE)  || (node->getNodeType() == DOMNode::CDATA_SECTION_NODE) )
		{
			DOMString val = node->getNodeValue();
			str += val;
		}
	}
	return str;
}
开发者ID:kobewang,项目名称:registrar_toolkit,代码行数:20,代码来源:EppUtil.cpp

示例13: create_PmtInf_body

void create_PmtInf_body(PmtInf *PmtOBj) {
	DOMNode *pmtInf =PmtOBj->getPmtInf_node();
	int counter = 0;
	DOMNodeList *pmtChildList = pmtInf->getChildNodes();
	DOMNode* node = NULL;
	char s[64] = { 0 };
	char *temp = NULL;
	Arb_numeric out_num = ARB_NUMERIC_ZERO;
	double e_amount;
	double s_amount;
	XMLCh *tempStr = NULL;
	//1,add nboftxs
	counter=PmtOBj->getNbOftxs();
	counter +=1;
	PmtOBj->setNbOftxs(counter);
	//2,add ctrlSum.
	arb_num_rate(&out_num, &gTrans.amount, 1, (gEur_impl_decimal - 2),gEur_round_method);
	arb_numeric_to_double(&out_num, &e_amount);
	PmtOBj->addCtrlSum(&out_num);

	/*for (size_t i = 0; i < pmtChildList->getLength(); ++i) {

		node = pmtChildList->item(i);
		tempStr = XMLString::transcode("NbOfTxs");

		if (XMLString::equals(node->getNodeName(), tempStr)) {
			XMLString::release(&tempStr);
			temp = XMLString::transcode(node->getTextContent());
			sprintf(s, "%d", atoi(temp) + 1);
			XMLString::release(&temp);
			tempStr = XMLString::transcode(s);
			node->setTextContent(tempStr);
			XMLString::release(&tempStr);
			counter++;
		}

		tempStr = XMLString::transcode("CtrlSum");
		if (XMLString::equals(node->getNodeName(), tempStr)) {
			XMLString::release(&tempStr);
			temp = XMLString::transcode(node->getTextContent());
			s_amount = atof(temp);
			XMLString::release(&temp);
			arb_num_rate(&out_num, &gTrans.amount, 1, (gEur_impl_decimal - 2),
					gEur_round_method);
			arb_numeric_to_double(&out_num, &e_amount);
			sprintf(s, "%d.%02.0f", (int) e_amount / 100, fmod(e_amount, 100));
			s_amount += atof(s);
			sprintf(s, "%.2f", s_amount);
			tempStr = XMLString::transcode(s);
			node->setTextContent(tempStr);
			XMLString::release(&tempStr);
			counter++;
		}

		if (counter == 2)
			break;

	}*/

	XmlNode pmtNode(pmtInf,doc);
	char endtoend[99]={0};
	sprintf(endtoend, "%02d%010d%03d%010d%03d%s", gTrans.tracking_id_serv,
			gTrans.tracking_id, gTrans.counter, gTrans.bill_ref_no,
			gTrans.bill_ref_resets, gTrans.sequence_type);
	sprintf(s, "%d.%02.0f", (int) e_amount / 100, fmod(e_amount, 100));
	char ustrd[99]={0};
	sprintf(ustrd, "%d/%d/%d/%d/%s/%s",
			gTrans.tracking_id_serv, gTrans.tracking_id, gTrans.bill_ref_no,
			gTrans.bill_ref_resets, gTrans.acct_ext_id, gTrans.mandate_id);

	XmlNode drctDbtTxInfNode = pmtNode.addChild("DrctDbtTxInf");
	drctDbtTxInfNode.addChild("PmtId").addChild("EndToEndId", endtoend);
	drctDbtTxInfNode.addChild("InstdAmt", s).addAttribute("Ccy", "EUR");
	XmlNode drectDbtTxNode = drctDbtTxInfNode.addChild("DrctDbtTx");
	XmlNode mndtRltdInfNode = drectDbtTxNode.addChild("MndtRltdInf");
	mndtRltdInfNode.addChild("MndtId", gTrans.mandate_id);
	mndtRltdInfNode.addChild("DtOfSgntr", gTrans.mandate_sign_date);

	if (strncmp(gTrans.mandate_reset, "Y", 1) == 0) {
		if ((strlen(gTrans.cust_bank_iban) != 0 && strcmp(
				gTrans.cust_bank_iban_hist, gTrans.cust_bank_iban) != 0)
				&& (strlen(gTrans.cust_bank_bic) != 0 && strcmp(
						gTrans.cust_bank_bic_hist, gTrans.cust_bank_bic) != 0)) {
			mndtRltdInfNode.addChild("AmdmntInd", "true");
			XmlNode AmdmntInfDtlsNode = mndtRltdInfNode.addChild(
					"AmdmntInfDtls");
			AmdmntInfDtlsNode.addChild("OrgnlDbtrAcct").addChild("Id").addChild(
					"IBAN", gTrans.cust_bank_iban_hist);
			AmdmntInfDtlsNode.addChild("OrgnlDbtrAgt").addChild("FinInstnId").addChild(
					"Othr").addChild("Id", "SMNDA");
		} else if (strlen(gTrans.cust_bank_iban) != 0 && strcmp(
				gTrans.cust_bank_iban_hist, gTrans.cust_bank_iban) != 0) {
			mndtRltdInfNode.addChild("AmdmntInd", "true");
			mndtRltdInfNode.addChild("AmdmntInfDtls").addChild("OrgnlDbtrAcct").addChild(
					"Id").addChild("IBAN", gTrans.cust_bank_iban_hist);

		} else if (strlen(gTrans.cust_bank_bic) != 0 && strcmp(
				gTrans.cust_bank_bic_hist, gTrans.cust_bank_bic) != 0) {
			mndtRltdInfNode.addChild("AmdmntInd", "true");
			mndtRltdInfNode.addChild("AmdmntInfDtls").addChild("OrgnlDbtrAgt").addChild(
//.........这里部分代码省略.........
开发者ID:huilang22,项目名称:Projects,代码行数:101,代码来源:eft_cr_xml.cpp

示例14: ParseActions

bool CConfigParser::ParseActions(DOMNodeList* actionNodeList, ADeviceListener& configClass)
{
	USES_CONVERSION;
	// Parse all the actions	
	if(actionNodeList != NULL && actionNodeList->getLength() > 0)
	{
		DOMNodeList* actionNodes = actionNodeList->item(0)->getChildNodes();
		for(unsigned long i = 0; i < actionNodes->getLength(); i++)
		{
			DOMNode* actionNode = actionNodes->item(i);
			wstring actionType = actionNode->getNodeName();
			if(actionType.compare(L"#text") == 0)
				continue;
			XMLCh* xmlChNameTxt = L"name";
			wstring actionName;
			if(actionNode->hasAttributes())
			{
				DOMNode* nameAttribute = actionNode->getAttributes()->getNamedItem(xmlChNameTxt);
				actionName = nameAttribute->getNodeValue();
			}			
			if(actionType.compare(L"sendCopyDataWindowMessage") == 0 || actionType.compare(L"sendCommandWindowMessage") == 0)
			{
				wstring message = actionNode->getAttributes()->getNamedItem(L"message")->getNodeValue();
				bool findByClass = FALSE;
				wstring windowAttributeName = L"window";
				if(actionNode->getAttributes()->getNamedItem(L"window") == NULL)
				{
					findByClass = TRUE;
					windowAttributeName = L"windowClass";
				}
				wstring window = actionNode->getAttributes()->getNamedItem(windowAttributeName.c_str())->getNodeValue();

				CSendWindowMessageAction* messageActionToAdd = NULL;
				if(actionType.compare(L"sendCommandWindowMessage") == 0)
				{
					messageActionToAdd = new CSendWindowMessageAction(_wtol(message.c_str()), OLE2T(window.c_str()), findByClass);
				}
				if(actionType.compare(L"sendCopyDataWindowMessage") == 0)
				{
					messageActionToAdd = new CSendWindowMessageAction(OLE2T(message.c_str()), OLE2T(window.c_str()), findByClass);
				}

				if(messageActionToAdd != NULL)
					configClass.AddAction(actionName, messageActionToAdd);
			}
			if(actionType.compare(L"execute") == 0)
			{
				char* executable = XMLString::transcode(
					actionNode->getAttributes()->getNamedItem(L"executable")->getNodeValue());
				char* commandline = XMLString::transcode(
					actionNode->getAttributes()->getNamedItem(L"commandline")->getNodeValue());
				configClass.AddAction(actionName, new CExecuteAction(executable, commandline));
				XMLString::release(&executable);
				XMLString::release(&commandline);
			}
			if(actionType.compare(L"keyPress") == 0)
			{
				TKeyList keys;

				DOMNodeList* keyNodes = actionNode->getChildNodes();
				unsigned long count = keyNodes->getLength();
				for(unsigned long keyIdx=0; keyIdx < keyNodes->getLength(); keyIdx++)
				{
					DOMNode* keyNode = keyNodes->item(keyIdx);
					if(wcscmp(keyNode->getNodeName(), L"#text") == 0)
						continue;
					
					const XMLCh* keyValue = keyNode->getFirstChild()->getNodeValue();
					if(keyValue == NULL)
						continue;

					int test = VK_CONTROL;
					keys.push_back(_wtoi(keyValue));					
				}
				configClass.AddAction(actionName, new CKeyboardAction(keys));
			}
			if(actionType.compare(L"winampPlayPause") == 0)
			{
				configClass.AddAction(actionName, new CWinampPlayPause());
			}
			if(actionType.compare(L"winampMute") == 0)
			{
				configClass.AddAction(actionName, new CWinampMute());
			}
			// We make the assumption that the macros were put at the end of the
			// config file, otherwise the actions they execute may not exist!
			if(actionType.compare(L"macro") == 0)
			{
				wstring type = actionNode->getAttributes()->getNamedItem(L"type")->getNodeValue();
				CMacroAction* actionToAdd = new CMacroAction(type.compare(L"all") == 0 ? true : false);
				DOMNodeList* macroActions = actionNode->getChildNodes();
				unsigned long count = macroActions->getLength();
				for(unsigned long actionIdx=0; actionIdx < count; actionIdx++)
				{
					DOMNode* macroActionNode = macroActions->item(actionIdx);
					if(wcscmp(macroActionNode->getNodeName(), L"#text") == 0)
						continue;

					wstring macroActionName = macroActionNode->getAttributes()->getNamedItem(L"name")->getNodeValue();
					actionToAdd->AddAction(configClass.GetActions()[macroActionName]);
//.........这里部分代码省略.........
开发者ID:rgeyer,项目名称:SpaceNavigatorHIDCapture,代码行数:101,代码来源:CConfigParser.cpp

示例15: if

EppServiceMenu * EppServiceMenu::fromXML( const DOMNode& root )
{
	EppServiceMenu * svcmenu = new EppServiceMenu();
	DOMNodeList* list = root.getChildNodes();

	for( unsigned int i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);
		DOMString name = node->getLocalName();

		if( name.isNull() )
		{
			name = node->getNodeName();
		}
		if( name.isNull() )
		{
			continue;
		}
		if( name.equals("version") )
		{
			svcmenu->addVersion(EppUtil::getText(*node));
		}
		else if( name.equals("lang") )
		{
			svcmenu->addLanguage(EppUtil::getText(*node));
		}
		else if( name.equals("objURI") )
		{
			DOMString uri = EppUtil::getText(*node);
			if( uri.isNotNull() && uri.length() > 0 )
			{
				svcmenu->addService(uri);
			}
		}
		else if( name.equals("svcExtension") )
		{
			DOMNodeList* ulist = node->getChildNodes();
			for( unsigned int j = 0; j < ulist->getLength(); j++ )
			{
				DOMNode* unode = ulist->item(j);
				name = unode->getLocalName();
				if( name.isNull() )
				{
					name = unode->getNodeName();
				}
				if( name.isNull() )
				{
					continue;
				}
				else if( name.equals("extURI") )
				{
					DOMString ext = EppUtil::getText(*unode);
					if( ext.isNotNull() && ext.length() > 0 )
					{
						svcmenu->addServiceExtension(ext);
					}
				}
			}
		}
	}

	return svcmenu;
}
开发者ID:neustar,项目名称:registrar_toolkit,代码行数:63,代码来源:EppServiceMenu.cpp


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