XML Parser - resolveExternalEntityName : how to resolve an code 26 error

Hello,

i'm using XMLParser to parse a RSSFeed. It was fine until few weeks ago. Now, I'm getting a code 26 error :

`Error Domain=NSXMLParserErrorDomain Code=26 "(null)" UserInfo={NSXMLParserErrorColumn=29, NSXMLParserErrorLineNumber=11, NSXMLParserErrorMessage=Entity 'rsquo' not defined

which relies to a special characters: ' . Once said, I found this function to help me resolving it but I don't manage to use it correctly, I don't know what to return to solve the error :

func parser(_ parser: XMLParser, resolveExternalEntityName name: String, systemID: String?) -> Data? {
    print("  entity \(name) || \(systemID)") // gives : entity rsquo || nil
    let newData = " ".data(using: .utf8)
    print("newdata \(newData)") //Optional(1 bytes)
    return newData

After this method is called, I still get a parseErrorOccured. What should i return ? Thanks in advance for feedbacks

As far as I tried, XMLParser (NSXMLParser) did not work as you expect, even if implementing parser(_:resolveExternalEntityName:systemID:) and/or setting shouldResolveExternalEntities = true.

You may need to work with libxml2 directly or find another library to parse XML including HTML entities such as rsquo.

XML Parser - resolveExternalEntityName : how to resolve an code 26 error
 
 
Q