Re: NSXMLParser - howto resolve entities defined in DTD
Re: NSXMLParser - howto resolve entities defined in DTD
- Subject: Re: NSXMLParser - howto resolve entities defined in DTD
- From: Dominik Pich <email@hidden>
- Date: Mon, 1 Jun 2009 21:43:39 +0200
:) thanks but ..... it doesnt work for me.
I read all that about NSParser just calling you back. I implemented
all the delegates BUT
I dont seem to be getting an appropriate callback for the Entities in
the DTD, although I did set 'shouldResolveExternalEntities = YES'
I get that messages asking me to PROVIDE a substitution for an entity
But I never get the messages FOR the declaration of the entities, so I
dont know WHAT to return as data.
I hope I explained my issue?
For example:
In the xml I have
"&nameOfPerson; goes to &nameOfCiname;" :)
I never get to know about the declares (which are in the DTD. which
should be loaded. no?)
> http://developer.apple.com/documentation/Cocoa/Conceptual/XMLParsing/Articles/ValidatingXML.html#/
/apple_ref/doc/uid/20002269-BBCFBAHB
On 01.06.2009, at 17:16, Keary Suska wrote:
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 (email@hidden)
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:
This email sent to email@hidden
Dominik Pich
http://www.pich.info
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden