* Source/NSXMLDocument.m

* Source/NSXMLDTD.m
	* Source/NSXMLDTDNode.m
	* Source/NSXMLElement.m
	* Source/NSXMLNode.m
	* Source/NSXMLPrivate.h: Reimplementation of all DOM classes based on
	libxml2.  Implementation of all methods using libxml2 functions.
	* Tests/base/NSXMLDocument/basic.m
	* Tests/base/NSXMLElement/attributes.m
	* Tests/base/NSXMLElement/children.m
	* Tests/base/NSXMLNode/basic.m
	* Tests/base/NSXMLNode/children.m
	* Tests/base/NSXMLNode/kinds.m: Changes to test for new functionality.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34789 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2012-02-20 03:40:15 +00:00
parent a2dbde8cec
commit f02339adda
13 changed files with 1702 additions and 559 deletions

View file

@ -0,0 +1,49 @@
#import "ObjectTesting.h"
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSXMLDocument.h>
#import <Foundation/NSXMLElement.h>
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSXMLElement *root1;
NSXMLElement *root2;
NSXMLNode *attr1;
NSXMLNode *attr2;
NSXMLNode *attrSameNameAsAttr1;
root1 = [[NSXMLElement alloc] initWithName: @"root1"];
root2 = [[NSXMLElement alloc] initWithName: @"root2"];
attr1 = [NSXMLNode attributeWithName: @"attr1" stringValue: @"foo"];
attr2 = [NSXMLNode attributeWithName: @"attr2" stringValue: @"foo"];
attrSameNameAsAttr1 = [NSXMLNode attributeWithName: @"attr1" stringValue: @"foo"];
PASS_RUNS([root1 addAttribute: attr1],
"may add attributes");
[root1 addAttribute: attr2];
PASS_EQUAL([root1 attributeForName: @"attr1"], attr1,
"element returns attribute by name");
PASS_RUNS([root1 removeAttributeForName: @"attr2"],
"removing attributes by name works");
PASS_EQUAL([root1 attributeForName: @"attr2"], nil,
"attribute is nil after removal");
[root1 addAttribute: attrSameNameAsAttr1];
PASS_EQUAL([root1 attributeForName: @"attr1"], attr1,
"may not overwrite pre-existing attributes");
PASS_EXCEPTION([root2 addAttribute: attr1],
NSInvalidArgumentException,
"cannot add attributes to multiple parents");
[root1 release];
[root2 release];
[arp release];
arp = nil;
return 0;
}

View file

@ -67,10 +67,12 @@ int main()
PASS_RUNS([root1 insertChild: c atIndex: 0],
"may add NSXMLCommentKind child");
/* Removed based on test run on Cocoa.
c = [[[NSXMLNode alloc] initWithKind:
NSXMLAttributeDeclarationKind] autorelease];
PASS_RUNS([root1 insertChild: c atIndex: 0],
"may add NSXMLAttributeDeclarationKind child");
*/
c = [[[NSXMLNode alloc] initWithKind:
NSXMLEntityDeclarationKind] autorelease];