易截截图软件、单文件、免安装、纯绿色、仅160KB

objective c xml解析

    今天在CC上看到evangel在招人,上面写了一条数据解析,我想应该就是对XML的解析吧,暂且这样理解了,呵呵。下午搜索了一点东西自己弄了一个XML然后读读看看,现在仅仅是读出了一些东西,先保存代码,待后续更新!
    这个是我创建的xml文件,用于测试用的:
<?xml version="1.0" encoding="UTF-8"?>
<book>
 <book1>
 <author>zhangsan</author>
 <title>Hello this is book1</title>
 <content>book1 is very good for testing!</content>
 </book1>
 <book2>
 <author>lisi</author>
 <title>Hello this is book2</title>
 <content>book2 is very good for testing!</content>
 </book2>
 <book3>
 <author>wangwu</author>
 <title>Hello this is book3</title>
 <content>book3 is very good for testing!</content>
 </book3>
</book>
对xml进行解析需要使用NSXMLParser类,首先声明一个NSXMLParser对象
NSXMLParser *xmlRead;
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"xml"];
 NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:path];
 NSData *data = [file readDataToEndOfFile];//得到xml文件
 [file closeFile];
 xmlRead = [[NSXMLParser alloc] initWithData:data];//初始化NSXMLParser对象
 [data release];
 [xmlRead setDelegate:self];//设置NSXMLParser对象的解析方法代理
 BOOL success = [xmlRead parse];//调用代理解析NSXMLParser对象,看解析是否成功
//解析器,从两个结点之间读取内容
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
NSLog(string);
}
//获得结点结尾的值
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
  namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
 NSLog(elementName);
}
//获得结点头的值
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName


相关文档:

.net中,读取XML在页面显示,布局用Repeater控件

 public static IList<News> GetAllNews()
        {
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load("你读取的地址:例如 ......

考查嵌入式C开发人员最好的十道题

非常基本关于C语言的问题,一个信息类(计算机,资讯工程,电子工程, 通信工程)专业的本科毕业生应该达到的水平。题目不难,全部都能快速地答完,当然也需要一定的知识储备。
对于大多数人,我们预期你可能答错 3)   4)  15)题,所以答错3道以内的,我们认为你很棒
答错5道题以内,我们认为你还不错(你还可能答 ......

linux下c语言关机程序

/* Offtimer.c.For auto halt. */
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define DELAY 60/* Time of sleeping */
int main()
{
  time_t now;
  struct tm *p;
  
  while(1)
  {
  now = time(NULL);
&n ......

C/C++编程GUI库比较

最强的GUI库当属Qt,毕竟是商业化的东西,功能最完整,什么都好,包括类似java代码风格,良好的框架设计,但有几点值的一提:
     1.它没有使用STL,而是自己实现了一套替代方案QTL;
     2.事件模型使用自创的signal/slot机制,所以需要moc.exe来预处理头文件;
  &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号