mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 20:26:42 +00:00
* Source/NSXMLNode.m (-detach): Don't handle the namespace case.
* Source/NSXMLElement.m (-removeNamespaceForPrefix:): Implement. * Tests/base/NSXMLNode/basic.m: Move tests from here ... * Tests/base/NSXMLElement/basic.m: ... to here. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34927 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f2ffb6dab9
commit
95c6da91e9
5 changed files with 96 additions and 51 deletions
|
@ -294,11 +294,44 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
[self _addSubNode: aNamespace];
|
||||
}
|
||||
|
||||
- (void) removeNamespaceForPrefix: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
if (internal->node->nsDef != NULL)
|
||||
{
|
||||
xmlNsPtr cur = internal->node->nsDef;
|
||||
xmlNsPtr last = NULL;
|
||||
const xmlChar *prefix = XMLSTRING(name);
|
||||
|
||||
while (cur != NULL)
|
||||
{
|
||||
if (xmlStrcmp(prefix, cur->prefix) == 0)
|
||||
{
|
||||
if (last == NULL)
|
||||
{
|
||||
internal->node->nsDef = cur->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
last->next = cur->next;
|
||||
}
|
||||
cur->next = NULL;
|
||||
if (cur->_private != NULL)
|
||||
{
|
||||
[self _removeSubNode: (NSXMLNode *)cur->_private];
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlFreeNode(cur);
|
||||
}
|
||||
return;
|
||||
}
|
||||
last = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setNamespaces: (NSArray*)namespaces
|
||||
|
@ -312,17 +345,7 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
// internal->node->nsDef = NULL;
|
||||
while ((namespace = (NSXMLNode *)[en nextObject]) != nil)
|
||||
{
|
||||
xmlNsPtr ns = (xmlNsPtr)[namespace _node];
|
||||
if (internal->node->nsDef == NULL)
|
||||
{
|
||||
internal->node->nsDef = ns;
|
||||
cur = ns;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur->next = ns;
|
||||
cur = ns;
|
||||
}
|
||||
[self addNamespace: namespace];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,7 +566,7 @@ joinTextNodes(xmlNodePtr nodeA, xmlNodePtr nodeB, NSMutableArray *nodesToDelete)
|
|||
subEnum = [nodesToDelete objectEnumerator];
|
||||
while ((subNode = [subEnum nextObject]))
|
||||
{
|
||||
[self _removeSubNode:subNode];
|
||||
[self _removeSubNode: subNode];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1052,9 +1052,17 @@ execute_xpath(NSXMLNode *xmlNode, NSString *xpath_exp, NSString *nmspaces)
|
|||
{
|
||||
NSXMLNode *parent = [self parent];
|
||||
|
||||
// separate our node from its parent and siblings
|
||||
xmlUnlinkNode(node);
|
||||
xmlSetTreeDoc(node, NULL);
|
||||
if (node->type == XML_NAMESPACE_DECL)
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
else
|
||||
{
|
||||
// separate our node from its parent and siblings
|
||||
xmlUnlinkNode(node);
|
||||
xmlSetTreeDoc(node, NULL);
|
||||
}
|
||||
|
||||
if (parent)
|
||||
{
|
||||
[parent _removeSubNode: self];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue