ObjFW  Check-in [00c9e85bdc]

Overview
Comment:Add -[elementForName] to OFXMLElement.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 00c9e85bdcec4ad9d7dd2ab6c1528ee9b2ec403e6df186b560f714bcd11329c9
User & Date: js on 2011-03-31 00:51:09
Other Links: manifest | tags
Context
2011-03-31
02:20
Throw an exception if parsing did not finish in +[elementWithString:]. check-in: 566996e9a6 user: js tags: trunk
00:51
Add -[elementForName] to OFXMLElement. check-in: 00c9e85bdc user: js tags: trunk
00:34
Add +[elementWithString:] to OFXMLElement. check-in: 415449f99b user: js tags: trunk
Changes

Modified src/OFXMLElement.h from [17d667d486] to [c2e1606d42].

324
325
326
327
328
329
330






331
332
333
334
335
336








337
338
339
340
341
342
343
344
/**
 * Adds a child to the OFXMLElement.
 *
 * \param child Another OFXMLElement which is added as a child
 */
- (void)addChild: (OFXMLElement*)child;







/**
 * \param elemname The name of the elements
 * \return The child elements with the specified name
 */
- (OFArray*)elementsForName: (OFString*)elemname;









/**
 * \param elemname The name of the elements
 * \param elemns The namespace of the elements
 * \return The child elements with the specified name and namespace
 */
- (OFArray*)elementsForName: (OFString*)elemname
		  namespace: (OFString*)elemns;
@end







>
>
>
>
>
>






>
>
>
>
>
>
>
>








324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/**
 * Adds a child to the OFXMLElement.
 *
 * \param child Another OFXMLElement which is added as a child
 */
- (void)addChild: (OFXMLElement*)child;

/**
 * \param elemname The name of the element
 * \return The first child element with the specified name
 */
- (OFXMLElement*)elementForName: (OFString*)elemname;

/**
 * \param elemname The name of the elements
 * \return The child elements with the specified name
 */
- (OFArray*)elementsForName: (OFString*)elemname;

/**
 * \param elemname The name of the element
 * \param elemns The namespace of the element
 * \return The first child element with the specified name and namespace
 */
- (OFXMLElement*)elementForName: (OFString*)elemname
		      namespace: (OFString*)elemns;

/**
 * \param elemname The name of the elements
 * \param elemns The namespace of the elements
 * \return The child elements with the specified name and namespace
 */
- (OFArray*)elementsForName: (OFString*)elemname
		  namespace: (OFString*)elemns;
@end

Modified src/OFXMLElement.m from [bc5b58bfe1] to [d25bc67d7d].

647
648
649
650
651
652
653






654
655
656
657
658
659







660
661
662
663
664
665
666
						       selector: _cmd];

	if (children == nil)
		children = [[OFMutableArray alloc] init];

	[children addObject: child];
}







- (OFArray*)elementsForName: (OFString*)elemname
{
	return [self elementsForName: elemname
			   namespace: nil];
}








- (OFArray*)elementsForName: (OFString*)elemname
		  namespace: (OFString*)elemns
{
	OFMutableArray *ret = [OFMutableArray array];
	OFXMLElement **children_c = [children cArray];
	size_t i, children_count = [children count];







>
>
>
>
>
>






>
>
>
>
>
>
>







647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
						       selector: _cmd];

	if (children == nil)
		children = [[OFMutableArray alloc] init];

	[children addObject: child];
}

- (OFXMLElement*)elementForName: (OFString*)elemname
{
	return [self elementForName: elemname
			  namespace: nil];
}

- (OFArray*)elementsForName: (OFString*)elemname
{
	return [self elementsForName: elemname
			   namespace: nil];
}

- (OFXMLElement*)elementForName: (OFString*)elemname
		      namespace: (OFString*)elemns
{
	return [[self elementsForName: elemname
			    namespace: elemns] firstObject];
}

- (OFArray*)elementsForName: (OFString*)elemname
		  namespace: (OFString*)elemns
{
	OFMutableArray *ret = [OFMutableArray array];
	OFXMLElement **children_c = [children cArray];
	size_t i, children_count = [children count];