parser(_:resolveExternalEntityName:systemID:) - return value documentation is unclear

Originator:igeek1
Number:rdar://32020891 Date Originated:05-May-2017 02:47 PM
Status:Open Resolved:
Product:Documentation Product Version:N/A
Classification:Suggestion Reproducible:N/A
 
Summary:
The documentation for XMLParserDelegate’s parser(_:resolveExternalEntityName:systemID:) method is unclear.


Steps to Reproduce:
1. Try to parse a document that has HTML entities such as ’ (single right quote).
2. Realize that XMLParser doesn’t handle these out of the box.
3. Try to use XMLparserDelegate’s parser(_:resolveExternalEntityName:systemID:) method to handle unknown entities and look them up in a mapping table.
4. Try to use the documentation to figure out what to return from that method.


Expected Results:
The documentation spells out exactly what to return, such as “A UTF-8 encoded string representing the entity” or something similar specific.


Observed Results:
The documentation says:

> An NSData object that contains the resolution of the given external entity.

This is not very helpful - what should I put in that NSData? How should I encode it? How will it be used? I haven’t been able to figure out what I’m supposed to return in a way that XMLParser will interpret it as characters instead of throwing an error in parser(_:parseErrorOccurred:) like this:

> Error Domain=NSXMLParserErrorDomain Code=26 "(null)" UserInfo={NSXMLParserErrorColumn=15, NSXMLParserErrorLineNumber=1, NSXMLParserErrorMessage=Entity 'rsquo' not defined


Version:



Notes:



Configuration:

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!