mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
* Source/NSXMLElement.m: Correct used namespace field.
* Source/NSXMLNode.m: Implement special handling for namespace nodes. * Tests/base/NSXMLNode/basic.m: Correct method name for namespace node. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34926 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d5c5a0bf87
commit
f2ffb6dab9
4 changed files with 134 additions and 80 deletions
|
@ -196,16 +196,8 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
|
||||
- (void) removeAttributeForName: (NSString*)name
|
||||
{
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlAttrPtr attr = xmlHasProp(node, XMLSTRING(name));
|
||||
NSXMLNode *attrNode = nil;
|
||||
NSXMLNode *attrNode = [self attributeForName: name];
|
||||
|
||||
if (NULL == attr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
attrNode = [NSXMLNode _objectForNode: (xmlNodePtr)attr];
|
||||
[attrNode detach];
|
||||
}
|
||||
|
||||
|
@ -260,8 +252,9 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
|
||||
- (NSXMLNode*) attributeForName: (NSString*)name
|
||||
{
|
||||
NSXMLNode *result = nil;
|
||||
xmlAttrPtr attributeNode = xmlHasProp(internal->node, XMLSTRING(name));
|
||||
NSXMLNode *result = nil;
|
||||
xmlNodePtr node = internal->node;
|
||||
xmlAttrPtr attributeNode = xmlHasProp(node, XMLSTRING(name));
|
||||
|
||||
if (NULL != attributeNode)
|
||||
{
|
||||
|
@ -282,13 +275,13 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
{
|
||||
xmlNsPtr ns = (xmlNsPtr)[aNamespace _node];
|
||||
|
||||
if (internal->node->ns == NULL)
|
||||
if (internal->node->nsDef == NULL)
|
||||
{
|
||||
internal->node->ns = ns;
|
||||
internal->node->nsDef = ns;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlNsPtr cur = internal->node->ns;
|
||||
xmlNsPtr cur = internal->node->nsDef;
|
||||
const xmlChar *prefix = ns->prefix;
|
||||
|
||||
while (xmlStrcmp(prefix, cur->prefix) != 0)
|
||||
|
@ -315,14 +308,14 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
xmlNsPtr cur = NULL;
|
||||
|
||||
// FIXME: Remove old namespaces
|
||||
// xmlFreeNsList(internal->node->ns);
|
||||
// internal->node->ns = NULL;
|
||||
// xmlFreeNsList(internal->node->nsDef);
|
||||
// internal->node->nsDef = NULL;
|
||||
while ((namespace = (NSXMLNode *)[en nextObject]) != nil)
|
||||
{
|
||||
xmlNsPtr ns = (xmlNsPtr)[namespace _node];
|
||||
if (internal->node->ns == NULL)
|
||||
if (internal->node->nsDef == NULL)
|
||||
{
|
||||
internal->node->ns = ns;
|
||||
internal->node->nsDef = ns;
|
||||
cur = ns;
|
||||
}
|
||||
else
|
||||
|
@ -337,7 +330,7 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
{
|
||||
// FIXME: Should use xmlGetNsList()
|
||||
NSMutableArray *result = nil;
|
||||
xmlNsPtr ns = internal->node->ns;
|
||||
xmlNsPtr ns = internal->node->nsDef;
|
||||
|
||||
if (ns)
|
||||
{
|
||||
|
@ -355,7 +348,8 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
- (NSXMLNode*) namespaceForPrefix: (NSString*)name
|
||||
{
|
||||
// FIXME: Should use xmlSearchNs()
|
||||
xmlNsPtr ns = internal->node->ns;
|
||||
xmlNsPtr ns = internal->node->nsDef;
|
||||
|
||||
if (ns)
|
||||
{
|
||||
const xmlChar *prefix = XMLSTRING(name);
|
||||
|
@ -387,7 +381,7 @@ GS_PRIVATE_INTERNAL(NSXMLElement)
|
|||
- (NSString*) resolvePrefixForNamespaceURI: (NSString*)namespaceURI
|
||||
{
|
||||
// FIXME Should use xmlSearchNsByHref()
|
||||
xmlNsPtr ns = internal->node->ns;
|
||||
xmlNsPtr ns = internal->node->nsDef;
|
||||
|
||||
if (ns)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue