• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSXMLParser and DTD-file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSXMLParser and DTD-file


  • Subject: NSXMLParser and DTD-file
  • From: Joakim Danielson <email@hidden>
  • Date: Wed, 24 Nov 2004 15:04:08 +0100

Hello

I have an XML file for my application that describes the mapping between my business classes and my database tables. The XML file uses a DTD document. The problem is that I can't get NSXMLParser to use the DTD file.

I think I have set everything up according to the documentation but I can't get it to work.

The code for initializing the parser looks like this:

...
NSData *xmlData = [[NSData alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"PersistenceMapper" ofType:@"xml"]];
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:xmlData];
[parser setShouldResolveExternalEntities:YES];


JDPersistenceXMLMapper *mapper = [[JDPersistenceXMLMapper alloc] initWithReceiver:self];


[parser setDelegate:mapper];


[parser parse];
...

and in the delegate I have implemented:

- (NSData *)parser:(NSXMLParser *)parser resolveExternalEntityName:(NSString *)entityName systemID:(NSString *)systemID {
NSLog(@"External Entity. Name: %@, system id: %@", entityName, systemID);


return [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"PersistenceMapper" ofType:@"dtd"]];
}

and my xml file starts with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE persistencemapper SYSTEM "PersistenceMapper.dtd">

But parser:resolveExternalEntityName:systemID never gets called. Could someone help me out with this.

Joakim
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Redirect web links to Safari
  • Next by Date: Re: help on 'help books'
  • Previous by thread: Re: Redirect web links to Safari
  • Next by thread: custom openPanel an browser
  • Index(es):
    • Date
    • Thread