forked from mykeepass/KeePassLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ParserTests.m
47 lines (36 loc) · 964 Bytes
/
ParserTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// ParserTests.m
// KeePass2
//
// Created by Qiang Yu on 2/11/10.
// Copyright 2010 Qiang Yu. All rights reserved.
//
#import "ParserTests.h"
#import "Kdb4Parser.h"
#import "WrapperNSData.h"
@interface ParserTests(PrivateMethods)
-(void)printTree:(Node *)node Indent:(int)indent;
@end
@implementation ParserTests
- (void) testParse {
/*WrapperNSData * data = [[WrapperNSData alloc] initWithContentsOfMappedFile:@"/Volumes/Users/qiang/Desktop/utf8.xml"];
Parser * p = [[Parser alloc]init];
Tree * tree = [p parse:data];
[ParserTests printTree:tree._root Indent:0];
[p release];
[data release];
*/
}
+(void)printTree:(Node *)node Indent:(int)indent{
NSMutableString * format = [[NSMutableString alloc]init];
for (int i=0; i<indent; i++){
[format appendString:@"\t"];
}
[format appendString:@"%@"];
NSLog(format, node);
for(Node * child in node._children){
[self printTree:child Indent:indent+1];
}
[format release];
}
@end