112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
R([elem[0] addChild: [OFXMLElement elementWithName: @"bar"]]) &&
[[elem[0] XMLString] isEqual:
@"<foo foo='b&ar'><bar/></foo>"] &&
R([elem[2] addChild: [OFXMLElement elementWithName: @"bar"
namespace: @"urn:objfw:test"]]) &&
[[elem[2] XMLString] isEqual:
@"<objfw-test:foo test='test'><objfw-test:bar/></objfw-test:foo>"])
TEST(@"-[elementsForName:namespace:]",
(a = [elem[2] elementsForName: @"bar"
namespace: @"urn:objfw:test"]) &&
[a count] == 1 && [[[a firstObject] XMLString] isEqual:
@"<bar xmlns='urn:objfw:test'/>"])
|
>
>
>
>
>
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
R([elem[0] addChild: [OFXMLElement elementWithName: @"bar"]]) &&
[[elem[0] XMLString] isEqual:
@"<foo foo='b&ar'><bar/></foo>"] &&
R([elem[2] addChild: [OFXMLElement elementWithName: @"bar"
namespace: @"urn:objfw:test"]]) &&
[[elem[2] XMLString] isEqual:
@"<objfw-test:foo test='test'><objfw-test:bar/></objfw-test:foo>"])
TEST(@"+[elementWithXMLString:] and -[stringValue]",
[[[OFXMLElement elementWithXMLString:
@"<x>foo<![CDATA[bar]]><y>baz</y>qux</x>"] stringValue] isEqual:
@"foobarbazqux"])
TEST(@"-[elementsForName:namespace:]",
(a = [elem[2] elementsForName: @"bar"
namespace: @"urn:objfw:test"]) &&
[a count] == 1 && [[[a firstObject] XMLString] isEqual:
@"<bar xmlns='urn:objfw:test'/>"])
|