mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
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:
parent
b00e4b6bb3
commit
63208fe5c1
2 changed files with 31 additions and 3 deletions
|
@ -2827,12 +2827,11 @@ startElementNsFunction(void *ctx, const unsigned char *name,
|
||||||
|
|
||||||
if (namespaces[pos] == 0)
|
if (namespaces[pos] == 0)
|
||||||
{
|
{
|
||||||
key = @"xmlns";
|
key = @"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
key = [@"xmlns:" stringByAppendingString:
|
key = UTF8Str(namespaces[pos]);
|
||||||
UTF8Str(namespaces[pos])];
|
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
if (namespaces[pos] == 0)
|
if (namespaces[pos] == 0)
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
#include <Foundation/NSError.h>
|
#include <Foundation/NSError.h>
|
||||||
|
#include <Foundation/NSEnumerator.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSXMLParser.h>
|
#include <Foundation/NSXMLParser.h>
|
||||||
#include <Foundation/NSData.h>
|
#include <Foundation/NSData.h>
|
||||||
|
@ -74,6 +75,7 @@ NSString* const NSXMLParserErrorDomain = @"NSXMLParserErrorDomain";
|
||||||
prefix: (NSString*)prefix
|
prefix: (NSString*)prefix
|
||||||
href: (NSString*)href
|
href: (NSString*)href
|
||||||
attributes: (NSMutableDictionary*)elementAttributes
|
attributes: (NSMutableDictionary*)elementAttributes
|
||||||
|
namespaces: (NSMutableDictionary*)elementNamespaces
|
||||||
{
|
{
|
||||||
NSString *qName = elementName;
|
NSString *qName = elementName;
|
||||||
|
|
||||||
|
@ -91,6 +93,33 @@ NSString* const NSXMLParserErrorDomain = @"NSXMLParserErrorDomain";
|
||||||
}
|
}
|
||||||
else
|
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
|
[_delegate parser: _owner
|
||||||
didStartElement: qName
|
didStartElement: qName
|
||||||
namespaceURI: nil
|
namespaceURI: nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue