Some xml namespace handling fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26002 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2008-01-26 08:34:58 +00:00
parent a6bfd106e1
commit 6425664347
4 changed files with 270 additions and 160 deletions

View file

@ -2794,23 +2794,24 @@ startElementNsFunction(void *ctx, const unsigned char *name,
int nb_attributes, int nb_defaulted,
const unsigned char **atts)
{
NSMutableDictionary *dict;
NSMutableDictionary *adict = nil;
NSMutableDictionary *ndict = nil;
NSString *elem;
NSCAssert(ctx,@"No Context");
elem = UTF8Str(name);
dict = [NSMutableDictionary dictionary];
if (atts != NULL)
{
int i;
int j;
adict = [NSMutableDictionary dictionaryWithCapacity: nb_attributes];
for (i = j = 0; i < nb_attributes; i++, j += 5)
{
NSString *key = UTF8Str(atts[j]);
NSString *obj = UTF8StrLen(atts[j+3], atts[j+4]-atts[j+3]);
[dict setObject: obj forKey: key];
[adict setObject: obj forKey: key];
}
}
if (nb_namespaces > 0)
@ -2818,6 +2819,7 @@ startElementNsFunction(void *ctx, const unsigned char *name,
int i;
int pos = 0;
ndict = [NSMutableDictionary dictionaryWithCapacity: nb_namespaces];
for (i = 0; i < nb_namespaces; i++)
{
NSString *key;
@ -2842,13 +2844,14 @@ startElementNsFunction(void *ctx, const unsigned char *name,
obj = UTF8Str(namespaces[pos]);
}
pos++;
[dict setObject: obj forKey: key];
[ndict setObject: obj forKey: key];
}
}
[HANDLER startElement: elem
prefix: UTF8Str(prefix)
href: UTF8Str(href)
attributes: dict];
attributes: adict
namespaces: ndict];
}
static void
@ -3055,6 +3058,18 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
[self startElement: elementName attributes: elementAttributes];
}
- (void) startElement: (NSString*)elementName
prefix: (NSString*)prefix
href: (NSString*)href
attributes: (NSMutableDictionary*)elementAttributes
namespaces: (NSMutableDictionary*)elementNamespaces
{
[self startElement: elementName
prefix: prefix
href: href
attributes: elementAttributes];
}
/**
* Called when a closing tag has been processed.
*/