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: Keary Suska <email@hidden>
- Date: Mon, 1 Jun 2009 16:03:17 -0600
On Jun 1, 2009, at 1:43 PM, Dominik Pich wrote:
:) 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?)
No. That's the point. NSXMLParser does nothing outside of parsing the
particular XML. It does not load DTDs, it does not validate, it does
not resolve any links. It is the responsibility of the delegate to
handle such things as DTD-related functions. You can use the NSXMLDTD
class for this.
All external entities must be declared in the core XML. If they
aren't, your XML is not well-formed. When the parser finds and
external entity declaration, the delegate is sent -
parser:foundExternalEntityDeclarationWithName:publicID:systemID: .
This just gives you a heads-up that the XML document expects to need
to resolve that entity. When it finds the entity, you should be sent -
parser:resolveExternalEntityName:systemID: (if you set the option),
where you return the declaration as it appears in the DTD (as NSData).
I believe that NSXMLDocument may provide the functionality that you
want, so you might want to look down that route.
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