34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
(nodes[1] = [OFXMLElement elementWithName: @"foo"
stringValue: @"b&ar"]) &&
[[nodes[1] XMLString] isEqual: @"<foo>b&ar</foo>"])
TEST(@"+[elementWithName:namespace:]",
(nodes[2] = [OFXMLElement elementWithName: @"foo"
namespace: @"urn:objfw:test"]) &&
R([nodes[2] addAttributeWithName: @"test"
stringValue: @"test"]) &&
R([nodes[2] setPrefix: @"objfw-test"
forNamespace: @"urn:objfw:test"]) &&
[[nodes[2] XMLString] isEqual: @"<objfw-test:foo test='test'/>"] &&
(nodes[3] = [OFXMLElement elementWithName: @"foo"
namespace: @"urn:objfw:test"]) &&
R([nodes[3] addAttributeWithName: @"test"
stringValue: @"test"]) &&
[[nodes[3] XMLString] isEqual:
@"<foo xmlns='urn:objfw:test' test='test'/>"])
TEST(@"+[elementWithName:namespace:stringValue:]",
(nodes[3] = [OFXMLElement elementWithName: @"foo"
namespace: @"urn:objfw:test"
stringValue: @"x"]) &&
|
|
<
|
<
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
(nodes[1] = [OFXMLElement elementWithName: @"foo"
stringValue: @"b&ar"]) &&
[[nodes[1] XMLString] isEqual: @"<foo>b&ar</foo>"])
TEST(@"+[elementWithName:namespace:]",
(nodes[2] = [OFXMLElement elementWithName: @"foo"
namespace: @"urn:objfw:test"]) &&
R([nodes[2] addAttributeWithName: @"test" stringValue: @"test"]) &&
R([nodes[2] setPrefix: @"objfw-test"
forNamespace: @"urn:objfw:test"]) &&
[[nodes[2] XMLString] isEqual: @"<objfw-test:foo test='test'/>"] &&
(nodes[3] = [OFXMLElement elementWithName: @"foo"
namespace: @"urn:objfw:test"]) &&
R([nodes[3] addAttributeWithName: @"test" stringValue: @"test"]) &&
[[nodes[3] XMLString] isEqual:
@"<foo xmlns='urn:objfw:test' test='test'/>"])
TEST(@"+[elementWithName:namespace:stringValue:]",
(nodes[3] = [OFXMLElement elementWithName: @"foo"
namespace: @"urn:objfw:test"
stringValue: @"x"]) &&
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
TEST(@"+[commentWithString:]",
(nodes[3] = [OFXMLComment commentWithString: @" comment "]) &&
[[nodes[3] XMLString] isEqual: @"<!-- comment -->"])
module = @"OFXMLElement";
TEST(@"-[addAttributeWithName:stringValue:]",
R([nodes[0] addAttributeWithName: @"foo"
stringValue: @"b&ar"]) &&
[[nodes[0] XMLString] isEqual: @"<foo foo='b&ar'/>"] &&
R([nodes[1] addAttributeWithName: @"foo"
stringValue: @"b&ar"]) &&
[[nodes[1] XMLString] isEqual:
@"<foo foo='b&ar'>b&ar</foo>"])
TEST(@"-[setPrefix:forNamespace:]",
R([nodes[1] setPrefix: @"objfw-test"
forNamespace: @"urn:objfw:test"]))
|
|
<
|
<
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
TEST(@"+[commentWithString:]",
(nodes[3] = [OFXMLComment commentWithString: @" comment "]) &&
[[nodes[3] XMLString] isEqual: @"<!-- comment -->"])
module = @"OFXMLElement";
TEST(@"-[addAttributeWithName:stringValue:]",
R([nodes[0] addAttributeWithName: @"foo" stringValue: @"b&ar"]) &&
[[nodes[0] XMLString] isEqual: @"<foo foo='b&ar'/>"] &&
R([nodes[1] addAttributeWithName: @"foo" stringValue: @"b&ar"]) &&
[[nodes[1] XMLString] isEqual:
@"<foo foo='b&ar'>b&ar</foo>"])
TEST(@"-[setPrefix:forNamespace:]",
R([nodes[1] setPrefix: @"objfw-test"
forNamespace: @"urn:objfw:test"]))
|