mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
* Source/NSXMLNode.m (-_nodeFollowingInNaturalDirection:): Correct
this method. * Source/NSXMLDocument.m, * Source/NSXMLElement.m: Clean up children methods. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34807 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
30c7457ba0
commit
dfb7d984d6
4 changed files with 97 additions and 117 deletions
|
@ -331,34 +331,28 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
|
||||
- (void) removeChildAtIndex: (NSUInteger)index
|
||||
{
|
||||
NSXMLNode *child;
|
||||
xmlNodePtr n;
|
||||
NSXMLNode *child;
|
||||
|
||||
if (index >= [self childCount])
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"index too large"];
|
||||
format: @"index too large"];
|
||||
}
|
||||
|
||||
child = [[self children] objectAtIndex: index];
|
||||
n = [child _node];
|
||||
xmlUnlinkNode(n);
|
||||
child = [self childAtIndex: index];
|
||||
[child detach];
|
||||
}
|
||||
|
||||
- (void) setChildren: (NSArray*)children
|
||||
{
|
||||
NSEnumerator *en;
|
||||
NSXMLNode *child;
|
||||
|
||||
while ([self childCount] > 0)
|
||||
NSUInteger count = [self childCount];
|
||||
|
||||
while (count-- > 0)
|
||||
{
|
||||
[self removeChildAtIndex: [self childCount] - 1];
|
||||
}
|
||||
en = [[self children] objectEnumerator];
|
||||
while ((child = [en nextObject]) != nil)
|
||||
{
|
||||
[self insertChild: child atIndex: [self childCount]];
|
||||
[self removeChildAtIndex: count];
|
||||
}
|
||||
|
||||
[self insertChildren: children atIndex: 0];
|
||||
}
|
||||
|
||||
- (void) addChild: (NSXMLNode*)child
|
||||
|
@ -448,38 +442,33 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error
|
||||
{
|
||||
#ifdef HAVE_LIBXSLT
|
||||
NSData *data = [[NSData alloc] initWithBytes: [xslt UTF8String]
|
||||
length: [xslt length]];
|
||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||
arguments: arguments
|
||||
error: error];
|
||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||
arguments: arguments
|
||||
error: error];
|
||||
[data release];
|
||||
return result;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (id) objectByApplyingXSLTAtURL: (NSURL*)xsltURL
|
||||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error
|
||||
{
|
||||
#ifdef HAVE_LIBXSLT
|
||||
NSData *data = [NSData dataWithContentsOfURL: xsltURL];
|
||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||
arguments: arguments
|
||||
error: error];
|
||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||
arguments: arguments
|
||||
error: error];
|
||||
return result;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL) validateAndReturnError: (NSError**)error
|
||||
{
|
||||
xmlValidCtxtPtr ctxt = xmlNewValidCtxt();
|
||||
// FIXME: Should use xmlValidityErrorFunc and userData
|
||||
// to get the error
|
||||
BOOL result = (BOOL)(xmlValidateDocument(ctxt, MY_DOC));
|
||||
xmlFreeValidCtxt(ctxt);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -494,7 +483,7 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
|
||||
- (BOOL) isEqual: (id)other
|
||||
{
|
||||
if(self == other)
|
||||
if (self == other)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue