mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
Improve nsxmlplarser test
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27633 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d9312191e7
commit
2364b90f04
1 changed files with 14 additions and 4 deletions
|
@ -65,12 +65,19 @@
|
||||||
if (startElem == 0)
|
if (startElem == 0)
|
||||||
{
|
{
|
||||||
startElem++;
|
startElem++;
|
||||||
if ([anElementName isEqual: @"example"] == NO)
|
if ([anElementName isEqual: @"example"] == NO) {
|
||||||
|
problem = YES;
|
||||||
NSLog(@"Bad start element '%@' in namespace '%@' '%@' attributes '%@'",
|
NSLog(@"Bad start element '%@' in namespace '%@' '%@' attributes '%@'",
|
||||||
anElementName, aNamespaceURI, aQualifierName, anAttributeDict);
|
anElementName, aNamespaceURI, aQualifierName, anAttributeDict);
|
||||||
|
}
|
||||||
|
if ([aQualifierName isEqual: @"foo:example"] == NO) {
|
||||||
|
problem = YES;
|
||||||
|
NSLog(@"Bad qualified name '%@'", aQualifierName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
problem = YES;
|
||||||
NSLog(@"Extra start element '%@' in namespace '%@' '%@' attributes '%@'",
|
NSLog(@"Extra start element '%@' in namespace '%@' '%@' attributes '%@'",
|
||||||
anElementName, aNamespaceURI, aQualifierName, anAttributeDict);
|
anElementName, aNamespaceURI, aQualifierName, anAttributeDict);
|
||||||
}
|
}
|
||||||
|
@ -85,12 +92,15 @@
|
||||||
if (endElem == 0)
|
if (endElem == 0)
|
||||||
{
|
{
|
||||||
endElem++;
|
endElem++;
|
||||||
if ([anElementName isEqual: @"example"] == NO)
|
if ([anElementName isEqual: @"example"] == NO) {
|
||||||
|
problem = YES;
|
||||||
NSLog(@"Bad end element '%@' in namespace '%@' '%@'",
|
NSLog(@"Bad end element '%@' in namespace '%@' '%@'",
|
||||||
anElementName, aNamespaceURI, aQualifierName);
|
anElementName, aNamespaceURI, aQualifierName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
problem = YES;
|
||||||
NSLog(@"Extra end element '%@' in namespace '%@' '%@'",
|
NSLog(@"Extra end element '%@' in namespace '%@' '%@'",
|
||||||
anElementName, aNamespaceURI, aQualifierName);
|
anElementName, aNamespaceURI, aQualifierName);
|
||||||
}
|
}
|
||||||
|
@ -107,8 +117,8 @@ int main ()
|
||||||
NSXMLParser *parser;
|
NSXMLParser *parser;
|
||||||
const char *str =
|
const char *str =
|
||||||
"<?xml version=\"1.0\"?>"
|
"<?xml version=\"1.0\"?>"
|
||||||
"<example>"
|
"<foo:example>"
|
||||||
"</example>";
|
"</foo:example>";
|
||||||
|
|
||||||
document = [NSData dataWithBytes: str length: strlen(str)];
|
document = [NSData dataWithBytes: str length: strlen(str)];
|
||||||
parser = [[NSXMLParser alloc] initWithData: document];
|
parser = [[NSXMLParser alloc] initWithData: document];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue