views:

390

answers:

1

Hi, I use NSXMLParser to parse large XML files-- going good BUT :) I cant get the parser to resolve the external entities from the DTD.

I googled and read documentation and older mails... and I did set parser.shouldResolveExternalEntities = YES

I do get: - (NSData *)parser:(AQXMLParser *)parser resolveExternalEntityName:(NSString *)name systemID:(NSString *)systemID but I have no idea what to return... the entities are defined in the DTD...

if I could get the folowing for the entries in the DTD, I would just build a table myself - (void)parser:(AQXMLParser *)parser foundInternalEntityDeclarationWithName:(NSString *)name value:(NSString *)value;

Still, shouldnt NSXMLParser do entity substitution for me? somehow... :)

In any case, I have no clue as to how to proceed


cross posted @ [email protected]

+1  A: 

Since URIs in DTDs are not necessarily pointing to the real location of the referenced object or entity it is the job of the delegate method to resolve the external entity:

In parser:resolveExternalEntityName:systemID:
use NSXMLDTD to load the external DTD (systemID) and
use the NSXMLDTDNode object returned by NSXMLDTD: entityDeclarationForName:entityName to resolve the entity

Volker Voecking
that works -- my topic didnt mention it explicityI cant use NSXML* it is cocoa-touch
sorry :( thanks for the quick response though