Overview
Comment: | Comply with section 6.2 of XML namespaces.
More specifically to this: |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ed63c0fdc19b7943890e68b96477c369 |
User & Date: | js on 2010-07-29 19:32:33 |
Other Links: | manifest | tags |
Context
2010-08-10
| ||
14:31 |
Update buildsys. This fixes a bug in buildsys.m4 that would cause some shells to fail. check-in: 991f76c2bc user: js tags: trunk | |
2010-07-29
| ||
19:32 | Comply with section 6.2 of XML namespaces. check-in: ed63c0fdc1 user: js tags: trunk | |
2010-07-25
| ||
11:23 | Update buildsys. This allows building a static and a shared lib at once. check-in: 85640ce6c1 user: js tags: trunk | |
Changes
Modified src/OFXMLElement.m from [9558fd2c7e] to [bd82ff1d44].
︙ | ︙ | |||
252 253 254 255 256 257 258 | pool2 = [[OFAutoreleasePool alloc] init]; for (j = 0; j < attrs_count; j++) { OFString *attr_name = [attrs_carray[j] name]; OFString *attr_prefix = nil; tmp = [[attrs_carray[j] stringValue] stringByXMLEscaping]; | < < < | < | | | | | | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | pool2 = [[OFAutoreleasePool alloc] init]; for (j = 0; j < attrs_count; j++) { OFString *attr_name = [attrs_carray[j] name]; OFString *attr_prefix = nil; tmp = [[attrs_carray[j] stringValue] stringByXMLEscaping]; if ([attrs_carray[j] namespace] != nil && (attr_prefix = [all_namespaces objectForKey: [attrs_carray[j] namespace]]) == nil) @throw [OFUnboundNamespaceException newWithClass: isa namespace: [attrs_carray[j] namespace]]; len += [attr_name cStringLength] + (attr_prefix != nil ? [attr_prefix cStringLength] + 1 : 0) + [tmp cStringLength] + 4; @try { str_c = [self resizeMemory: str_c |
︙ | ︙ |
Modified src/OFXMLParser.m from [86d4782143] to [0ff2c07a09].
︙ | ︙ | |||
56 57 58 59 60 61 62 | static OF_INLINE void resolve_attr_namespace(OFXMLAttribute *attr, OFString *prefix, OFString *ns, OFArray *namespaces, Class isa) { OFString *attr_ns; OFString *attr_prefix = attr->namespace; | | < < | < | < | < | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | static OF_INLINE void resolve_attr_namespace(OFXMLAttribute *attr, OFString *prefix, OFString *ns, OFArray *namespaces, Class isa) { OFString *attr_ns; OFString *attr_prefix = attr->namespace; if (attr_prefix == nil) return; attr_ns = namespace_for_prefix(attr_prefix, namespaces); if ((attr_prefix != nil && attr_ns == nil)) @throw [OFUnboundNamespaceException newWithClass: isa prefix: attr_prefix]; [attr->namespace release]; attr->namespace = [attr_ns retain]; } |
︙ | ︙ |
Modified tests/OFXMLElementTests.m from [f1b03ff45a] to [56acb16688].
︙ | ︙ | |||
37 38 39 40 41 42 43 | stringValue: @"b&ar"]) && [[elem[1] string] isEqual: @"<foo>b&ar</foo>"]) TEST(@"+[elementWithName:namespace:]", (elem[2] = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test"]) && R([elem[2] addAttributeWithName: @"test" | < | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | stringValue: @"b&ar"]) && [[elem[1] string] isEqual: @"<foo>b&ar</foo>"]) TEST(@"+[elementWithName:namespace:]", (elem[2] = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test"]) && R([elem[2] addAttributeWithName: @"test" stringValue: @"test"]) && R([elem[2] setPrefix: @"objfw-test" forNamespace: @"urn:objfw:test"]) && [[elem[2] string] isEqual: @"<objfw-test:foo test='test'/>"]) TEST(@"+[elementWithName:namespace:stringValue:]", (elem[3] = [OFXMLElement elementWithName: @"foo" |
︙ | ︙ |
Modified tests/OFXMLParserTests.m from [88d490bdfe] to [a5fed6b08d].
︙ | ︙ | |||
104 105 106 107 108 109 110 | /* foo:bla attr */ [[[attrs objectAtIndex: 0] name] isEqual: @"bla"] && [[[attrs objectAtIndex: 0] namespace] isEqual: @"urn:objfw:test:foo"] && [[[attrs objectAtIndex: 0] stringValue] isEqual: @"bla"] && /* blafoo attr */ [[[attrs objectAtIndex: 1] name] isEqual: @"blafoo"] && | | < | < | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | /* foo:bla attr */ [[[attrs objectAtIndex: 0] name] isEqual: @"bla"] && [[[attrs objectAtIndex: 0] namespace] isEqual: @"urn:objfw:test:foo"] && [[[attrs objectAtIndex: 0] stringValue] isEqual: @"bla"] && /* blafoo attr */ [[[attrs objectAtIndex: 1] name] isEqual: @"blafoo"] && [[attrs objectAtIndex: 1] namespace] == nil && [[[attrs objectAtIndex: 1] stringValue] isEqual: @"foo"]) break; case 12: TEST(msg, et == STRING && [string isEqual: @"\n "]) break; case 13: TEST(msg, et == TAG_START && [name isEqual: @"blup"] && prefix == nil && [ns isEqual: @"urn:objfw:test:foobar"] && [attrs count] == 2 && /* foo:qux attr */ [[[attrs objectAtIndex: 0] name] isEqual: @"qux"] && [[[attrs objectAtIndex: 0] namespace] isEqual: @"urn:objfw:test:foo"] && [[[attrs objectAtIndex: 0] stringValue] isEqual: @"asd"] && /* quxqux attr */ [[[attrs objectAtIndex: 1] name] isEqual: @"quxqux"] && [[attrs objectAtIndex: 1] namespace] == nil && [[[attrs objectAtIndex: 1] stringValue] isEqual: @"test"]) break; case 14: TEST(msg, et == TAG_END && [name isEqual: @"blup"] && prefix == nil && [ns isEqual: @"urn:objfw:test:foobar"]) break; case 15: |
︙ | ︙ | |||
145 146 147 148 149 150 151 | [[[attrs objectAtIndex: 0] name] isEqual: @"bla"] && [[[attrs objectAtIndex: 0] namespace] isEqual: @"http://www.w3.org/2000/xmlns/"] && [[[attrs objectAtIndex: 0] stringValue] isEqual: @"urn:objfw:test:bla"] && /* qux attr */ [[[attrs objectAtIndex: 1] name] isEqual: @"qux"] && | | < | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | [[[attrs objectAtIndex: 0] name] isEqual: @"bla"] && [[[attrs objectAtIndex: 0] namespace] isEqual: @"http://www.w3.org/2000/xmlns/"] && [[[attrs objectAtIndex: 0] stringValue] isEqual: @"urn:objfw:test:bla"] && /* qux attr */ [[[attrs objectAtIndex: 1] name] isEqual: @"qux"] && [[attrs objectAtIndex: 1] namespace] == nil && [[[attrs objectAtIndex: 1] stringValue] isEqual: @"qux"] && /* bla:foo attr */ [[[attrs objectAtIndex: 2] name] isEqual: @"foo"] && [[[attrs objectAtIndex: 2] namespace] isEqual: @"urn:objfw:test:bla"] && [[[attrs objectAtIndex: 2] stringValue] isEqual: @"blafoo"]) break; |
︙ | ︙ | |||
173 174 175 176 177 178 179 | /* xmlns attr */ [[[attrs objectAtIndex: 0] name] isEqual: @"xmlns"] && [[attrs objectAtIndex: 0] namespace] == nil && [[[attrs objectAtIndex: 0] stringValue] isEqual: @"urn:objfw:test:abc"] && /* abc attr */ [[[attrs objectAtIndex: 1] name] isEqual: @"abc"] && | | < | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | /* xmlns attr */ [[[attrs objectAtIndex: 0] name] isEqual: @"xmlns"] && [[attrs objectAtIndex: 0] namespace] == nil && [[[attrs objectAtIndex: 0] stringValue] isEqual: @"urn:objfw:test:abc"] && /* abc attr */ [[[attrs objectAtIndex: 1] name] isEqual: @"abc"] && [[attrs objectAtIndex: 1] namespace] == nil && [[[attrs objectAtIndex: 1] stringValue] isEqual: @"abc"] && /* foo:abc attr */ [[[attrs objectAtIndex: 2] name] isEqual: @"abc"] && [[[attrs objectAtIndex: 2] namespace] isEqual: @"urn:objfw:test:foo"] && [[[attrs objectAtIndex: 2] stringValue] isEqual: @"abc"]) break; |
︙ | ︙ |