0

I have an Bundle folder, which consist of one .XML file and one folder. Which look like thisBundle Folder Structure

Here i have read the .XML file using NSXml Parser. The XML will look like,

<?xml version="1.0" standalone="yes"?>
<user id="32" name="lima"><class id="1" name="Third">  
<pages id="2" name="Page002.html" url="matematica/Page002.html"/>
</user>

I have read the URL value also, but how i have to give the URL value in the XML file, the Page002.html is inside the matematica folder. How i have to give that path in XML.? I'm loading that .HTML file in UIWebview. If i give like matematica/Page002.html webview can't find the path.

Harish
  • 2,496
  • 4
  • 24
  • 48
  • 1
    Post some code what have you done ? – V-Xtreme Apr 10 '13 at 06:27
  • I just want to extract the url value in XML and i want to display it in webview. I have done all, but i want to know what URL path i have to give in XML url attribute... – Harish Apr 10 '13 at 06:31

2 Answers2

3

try this

NSString *path=[[NSBundle mainBundle] pathForResource:@"Page002" ofType:@"html" inDirectory:@"matematica"];
iAppDeveloper
  • 1,088
  • 1
  • 8
  • 16
1

The folder Structure of in the Xcode is just logical grouping its nothing to do with the url . so off course your url is wrong in above case . You have give the full path of inside the url . You can get it by using :

  NSString *path=[[NSBundle mainBundle] pathForResource:@"Page002" ofType:@"html"];

then you can load it by :

[WebView loadRequest:[NSURLRequest requestWithURL:[NSUrl urlWithString:path]]]
V-Xtreme
  • 7,230
  • 9
  • 39
  • 79
  • i have to give like .. if i give like this.. The url is matematica/Page002.html... so webview not loading – Harish Apr 10 '13 at 06:58
  • @HarishSaran: "matematica/Page002.html" this url is wrong . You can get the valid url by: NSString *path=[[NSBundle mainBundle] pathForResource:@"Page002" ofType:@"html"]; – V-Xtreme Apr 10 '13 at 07:02
  • i understand that.. but i have the XML file inside the Bundle_Files folder also the HTML path is inside the Bundle_Files folder,so how can i give the URL PATH IN XML url attribute TAG.. – Harish Apr 10 '13 at 07:17
  • @HarishSaran: I have mentioned in the answer than The folder structure in Xcode is just logical grouping .so You don't have to worry about the where your xml file or the html file is present . For the demo purpose just paste the path which you are getting by my first line of the code into the xml . and load the web view . it should work . – V-Xtreme Apr 10 '13 at 07:36