NSXMLDTD does not return notations
| Originator: | craig | ||
| Number: | rdar://18975903 | Date Originated: | 14/11/2014 |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | 10.10 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
I'm trying to use NSXMLDocument and NSXMLDTD to parse some XML, but for some reason, NSXMLDTD never returns the DTD notations.
Steps to Reproduce:
Using the following code, you can see that it happily picks up the entities and elements, however, it doesn't return the notations. Even if I inspect the internal _notations variable, I can see that it is always nil.
int main(int argc, char *argv[]) {
@autoreleasepool {
NSString *xml = @""
"<?xml version=\"1.0\" standalone=\"yes\" ?>\n"
"<!DOCTYPE xxx SYSTEM \"XXX\" [\n"
" <!ENTITY blah SYSTEM \"BLAH\" NDATA note>\n"
" <!NOTATION note PUBLIC \"my notation\">\n"
" <!ELEMENT xxx (#PCDATA)>\n"
"]>\n"
"<xxx>some text</xxx>";
NSData *xmlData = [xml dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData:xmlData options:NSXMLNodePreserveAll error:&error];
NSLog(@"Entity = %@", [[doc DTD] entityDeclarationForName:@"blah"]);
NSLog(@"Element = %@", [[doc DTD] elementDeclarationForName:@"xxx"]);
NSLog(@"Notation = %@", [[doc DTD] notationDeclarationForName:@"note"]);
}
}
Expected Results:
I expect to see the notations output to the console
Actual Results:
The notations are nil.
Version:
OS X 10.9.5 (13F34)
OS X 10.10 (14A389)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!