53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
OFXMLElement *elem;
elem = [OFXMLElement elementWithName: @"foo"];
CHECK([[elem string] isEqual: @"<foo/>"]);
[elem addAttributeWithName: @"foo"
andValue: @"b&ar"];
CHECK([[elem string] isEqual: @"<foo foo='b&ar'/>"])
[elem addChild: [OFXMLElement elementWithName: @"bar"]];
CHECK([[elem string] isEqual: @"<foo foo='b&ar'><bar/></foo>"])
elem = [OFXMLElement elementWithName: @"foo"
andStringValue: @"b&ar"];
CHECK([[elem string] isEqual: @"<foo>b&ar</foo>"])
[elem addAttributeWithName: @"foo"
andValue: @"b&ar"];
CHECK([[elem string] isEqual: @"<foo foo='b&ar'>b&ar</foo>"])
puts("");
return 0;
}
|
|
|
|
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
OFXMLElement *elem;
elem = [OFXMLElement elementWithName: @"foo"];
CHECK([[elem string] isEqual: @"<foo/>"]);
[elem addAttributeWithName: @"foo"
stringValue: @"b&ar"];
CHECK([[elem string] isEqual: @"<foo foo='b&ar'/>"])
[elem addChild: [OFXMLElement elementWithName: @"bar"]];
CHECK([[elem string] isEqual: @"<foo foo='b&ar'><bar/></foo>"])
elem = [OFXMLElement elementWithName: @"foo"
stringValue: @"b&ar"];
CHECK([[elem string] isEqual: @"<foo>b&ar</foo>"])
[elem addAttributeWithName: @"foo"
stringValue: @"b&ar"];
CHECK([[elem string] isEqual: @"<foo foo='b&ar'>b&ar</foo>"])
puts("");
return 0;
}
|