zim
zim

Reputation: 47

parsing a local saved XML file

Good morning every one,

I have donloaded an XML File to my documents folder but how can I determinate the path to the file so I can parse it?!?

I tryed it with

NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *localPath = [rootPath stringByAppendingPathComponent:@"test.xml"];

and i get this mesage:

/.../.../Library/Application Support/iPhone Simulator/4.0/Applications/AF71BAFD-2014-4A79-BEA8-D6D9D2A6BBDB/Documents/test.xml
Entity: line 1: parser error : Start tag expected, '<' not found
/.../.../Library/Application Support/iPhone Simulator/4.0/Applications/

the XML File is in the correct format since i can Parse without any problems from the server can anyone Help me with that?!?

Upvotes: 1

Views: 718

Answers (1)

PeyloW
PeyloW

Reputation: 36752

Begin with logging the contents of the local file using:

NSLog(@"Local xml: %@", [NSString stringWithContentsOfFile:localPath
                                                  encoding:NSUFT8StringEncoding
                                                     error:NULL]);

Just to validate that the local contents are actually correct. Correct on the server does not guarantee that something did not went amiss on it's path to the client.

Upvotes: 1

Related Questions