On May 31, 2009, at 4:31 PM, Dominik Pich wrote:

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

Well, the docs state: 1) "An NSXMLParser notifies its delegate about the items (elements, attributes, CDATA blocks, comments, and so on) that it encounters as it processes an XML document. It does not itself do anything with those parsed items except report them." and 2) in setShouldResolveExternalEntities, "Indicates whether the receiver reports declarations of external entities using the delegate method parser:foundExternalEntityDeclarationWithName:publicID:systemID:."

I should be clear, then, that NSXMLParser does *not* resolve external entities in any way, only reports them, and explains what you see.

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...

As the docs say, "An NSData object that contains the resolution of the given external entity"

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... :)


The companion document to NSXMLParser, "Event-Driven XML Programming Guide for Cocoa", tells you what you need to do to resolve external entities.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to