namespace bugfixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26003 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2008-01-26 09:23:49 +00:00
parent 6425664347
commit 2b48d85f2a
2 changed files with 31 additions and 3 deletions

View file

@ -2827,12 +2827,11 @@ startElementNsFunction(void *ctx, const unsigned char *name,
if (namespaces[pos] == 0)
{
key = @"xmlns";
key = @"";
}
else
{
key = [@"xmlns:" stringByAppendingString:
UTF8Str(namespaces[pos])];
key = UTF8Str(namespaces[pos]);
}
pos++;
if (namespaces[pos] == 0)

View file

@ -26,6 +26,7 @@
#include "config.h"
#include <Foundation/NSArray.h>
#include <Foundation/NSError.h>
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSException.h>
#include <Foundation/NSXMLParser.h>
#include <Foundation/NSData.h>
@ -74,6 +75,7 @@ NSString* const NSXMLParserErrorDomain = @"NSXMLParserErrorDomain";
prefix: (NSString*)prefix
href: (NSString*)href
attributes: (NSMutableDictionary*)elementAttributes
namespaces: (NSMutableDictionary*)elementNamespaces
{
NSString *qName = elementName;
@ -91,6 +93,33 @@ NSString* const NSXMLParserErrorDomain = @"NSXMLParserErrorDomain";
}
else
{
/* When we are not handling namespaces specially, any namespaces
* should appear as attributes of the element.
*/
if ([elementNamespaces count] > 0)
{
NSEnumerator *e = [elementNamespaces keyEnumerator];
NSString *k;
if (elementAttributes == nil)
{
elementAttributes = [NSMutableDictionary dictionary];
}
while ((k = [e nextObject]) != nil)
{
NSString *v = [elementNamespaces objectForKey: k];
if ([k length] == 0)
{
[elementAttributes setObject: v forKey: @"xmlns"];
}
else
{
k = [@"xmlns:" stringByAppendingString: k];
[elementAttributes setObject: v forKey: k];
}
}
}
[_delegate parser: _owner
didStartElement: qName
namespaceURI: nil