可配置练习

 

from xml.dom import minidom
import sys
import os

try:
 xmldoc = minidom.parse("text.xml")
 print '=====xmldoc======'
except:
 print '=====SYS======'
 sys.exit(0)

for node in xmldoc.getElementsByTagName("item"):
 iditem = node.getAttribute("id")
 captionitem = node.getElementsByTagName("caption")
 for i in captionitem:
   
 
 print '==========='
 print iditem
 print captionitem
 

 

#ifndef XXX_H
#define XXX_H

extern const char *szPhone1;
extern const char *szPhone2;
extern const char *szPhone3;
extern const char *szPhone4;

typedef struct _Test Test;

typedef void(*FUNCPRINT)(const Test pData);

struct _Test
{
 int        nEnum;
 const char *szStr;
 FUNCPRINT  pFunc;
};

#endif

#include "001.h"

const char *szPhone1 = "/phone/one";
const char *szPhone2 = "/phone/two";
const char *szPhone3 = "/phone/three";
const char *szPhone4 = "/phone/four";

 

#include <stdio.h>
#include "001.h"


static void GOPrintf(const Test pData)
{
 printf("[%d]:%s\n", pData.nEnum, pData.szStr);
}

static const Test m_szTest[] =
{
 {1, szPhone1, GOPrintf},
 {2, szPhone2, GOPrintf},
 {3, szPhone3, GOPrintf},
 {4, szPhone4, GOPrintf},
};

int main()
{
 int i      = 0;
 int nCount = 0;

 nCount = sizeof(m_szTest)/sizeof(Test);

 for (i = 0; i < nCount; i++)
 {
  (*m_szTest[i].pFunc)(m_szTest[i]);
 }

}

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值