xml parsing fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31852 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-01-07 14:41:44 +00:00
parent 53157fa22c
commit 5e5a6b7c8c
2 changed files with 17 additions and 4 deletions

View file

@ -3,6 +3,8 @@
* Source/NSObject.m: Make zombie log message match current OSX.
* Source/NSURL.m: Fix -resourceSpecifier by removing incorrect
special handling for file URLs.
* Source/NSXMLParser.m: Maketolerant of whitespace around the '='
in an attribute. Fix check for xml header being at start of doc.
2011-01-06 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -1436,6 +1436,7 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
NSMutableDictionary *parameters;
NSString *arg;
const unsigned char *tp = this->cp; // tag pointer
const unsigned char *sp = tp - 1; // Open angle bracket
/* After processing a tag, whitespace will be ignorable and
* we can start accumulating it in our buffer.
@ -1564,9 +1565,11 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
@"<?tag ...? is missing the >"
code: NSXMLParserGTRequiredError];
}
// process
if ([tag isEqualToString: @"xml"]
&& tp != [this->data bytes])
/* If this is the <?xml header, the opening angle
* bracket MUST be at the start of the data.
*/
if ([tag isEqualToString: @"?xml"]
&& sp != [this->data bytes])
{
return [self _parseError: @"bad <?xml > preamble"
code: NSXMLParserDocumentStartError];
@ -1599,13 +1602,21 @@ NSLog(@"_processTag <%@%@ %@>", flag?@"/": @"", tag, attributes);
return [self _parseError: @"empty attribute name"
code: NSXMLParserAttributeNotStartedError];
}
c = cget(); // get delimiting character
c = cget();
while (isspace(c))
{
c = cget();
}
if (c == '=')
{
NSString *val;
// explicit assignment
c = cget(); // skip =
while (isspace(c))
{
c = cget();
}
val = [self _newQarg];
[parameters setObject: val forKey: arg];
[val release];