Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8284569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:09:14+00:00 2026-06-08T11:09:14+00:00

I am new to iPhone developer, I made epub reader for my application, in

  • 0

I am new to iPhone developer,

I made epub reader for my application, in which i want to fetch all the value of <text> tag from my local .html page and i want to store it in my array.

For eg:
This is my toc.html file, from this file i want to fetch all the value of <text> tag,

<navMap>
    <navPoint class="chapter" id="navpoint-1" playOrder="1">
        <navLabel>
           <text>Cover</text>
        </navLabel>
      <content src="Morning Insight 26 April - K S 2/Morning Insight 26 April - K S 2/Morning Insight 26 April - K S/Morning Insight 26 April - K S/Morning Insight/OEBPS/first.html"/>
   </navPoint>

     <navPoint class="chapter" id="navpoint-2" playOrder="2">
        <navLabel>
          <text>News</text>
        </navLabel>
      <content src="Morning Insight 26 April - K S 2/Morning Insight 26 April - K S 2/Morning Insight 26 April - K S/Morning Insight 26 April - K S/Morning Insight/OEBPS/1.html"/>
   </navPoint>

    <navPoint class="chapter" id="navpoint-3" playOrder="3">
       <navLabel>
          <text>Report</text>
       </navLabel>
      <content src="Morning Insight 26 April - K S 2/Morning Insight 26 April - K S 2/Morning Insight 26 April - K S/Morning Insight 26 April - K S/Morning Insight/OEBPS/2.html"/>
    </navPoint>

    <navPoint class="chapter" id="navpoint-4" playOrder="4">
       <navLabel>
          <text>Economy Update</text>
       </navLabel>
      <content src="Morning Insight 26 April - K S 2/Morning Insight 26 April - K S 2/Morning Insight 26 April - K S/Morning Insight 26 April - K S/Morning Insight/OEBPS/3.html"/>
    </navPoint>

<navMap>

finally my array should have:

array at 0: Cover
array at 1: News
array at 2: Report
array at 3: Economy Update

EDIT:

- (NSString *)dataFilePath:(BOOL)forSave {
    NSLog(@"Path of my file=%@",TOC);
    return TOC;
}

-(void)viewDidAppear:(BOOL)animated{

    [super viewDidLoad];
    TOCArray=[[NSMutableArray alloc]init];

    NSString *filePath = [self dataFilePath:FALSE];
    NSData *response = [[NSMutableData alloc] initWithContentsOfFile:filePath];
    GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:response options:0 error:nil];

    NSArray *navPoints = [[[doc.rootElement elementsForName:@"navMap"] lastObject] elementsForName:@"navPoint"];

    for (GDataXMLElement *m in navPoints)
    {
        NSArray *navLabel = [m elementsForName:@"navLabel"];
        for (GDataXMLElement *e in navLabel)
        {
            NSArray *text = [e elementsForName:@"text"];
            [TOCArray addObject:[text objectAtIndex:0]];
        }
    }

    for (int i=0; i<[TOCArray count]; i++) {
        NSLog(@"Toc array=%@",[TOCArray objectAtIndex:i]);
    }

}

My log Shows: Path of my file=/Users/krunal/Library/Application Support/iPhone Simulator/5.0/Applications/D414BC19-C005-4D93-896D-A6FB71DE4D21/Documents/UnzippedEpub/toc.ncx

but my array is still null.

here is my toc.ncx file http://www.mediafire.com/?4r883s80he23cua

NEW EDIT

2012-07-23 16:07:50.522  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96480: {type:1 name:text xml:"<text>Cover</text>"}
2012-07-23 16:07:50.522  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96610: {type:1 name:text xml:"<text>News</text>"}
2012-07-23 16:07:50.523  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96730: {type:1 name:text xml:"<text>Report</text>"}
2012-07-23 16:07:50.523  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96850: {type:1 name:text xml:"<text>Economy Update</text>"}
2012-07-23 16:07:50.524  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96970: {type:1 name:text xml:"<text>Other Factors</text>"}
2012-07-23 16:07:50.524  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96aa0: {type:1 name:text xml:"<text>Result Update</text>"}
2012-07-23 16:07:50.525  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96bc0: {type:1 name:text xml:"<text>Result Update (Continued)</text>"}
2012-07-23 16:07:50.526  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96ce0: {type:1 name:text xml:"<text>Trends in NIM</text>"}
2012-07-23 16:07:50.526  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96e00: {type:1 name:text xml:"<text>Key Stats</text>"}
2012-07-23 16:07:50.527  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96f40: {type:1 name:text xml:"<text>Result Update</text>"}
2012-07-23 16:07:50.527  iBook [2105:fe03] Toc array=GDataXMLElement 0x6a97060: {type:1 name:text xml:"<text>Disclaimer</text>"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:09:17+00:00Added an answer on June 8, 2026 at 11:09 am

    I did some xml parsing for an app using GData & TouchXML..

    Create an array to hold values.

    Assuming your call to service returns NSData stored in response. Create a GDataXMLDocument object from it.

    - (NSArray*)textArrayFromNCX
    {
        NSMutableArray *values = [NSMutableArray array];
    
        // get the toc.ncx from documents folder
        NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
        docPath = [docPath stringByAppendingPathComponent:@"UnzippedEpub"];
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"toc" ofType:@"ncx" inDirectory:docPath];
    
        // init the xml document
        NSData *response = [[NSMutableData alloc] initWithContentsOfFile:filePath];
        GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:response options:0 error:nil];
    
        // loop through the elements
        NSArray *navPoints = [[[doc.rootElement elementsForName:@"navMap"] lastObject] elementsForName:@"navPoint"];
        for (GDataXMLElement *m in navPoints)
        {
            NSArray *navLabel = [m elementsForName:@"navLabel"];
            for (GDataXMLElement *e in navLabel)
            {
                NSArray *text = [e elementsForName:@"text"];
                [values addObject:[[text lastObject] stringValue]];
            }
        }
    
        return values;
    }
    

    the GData Library returns array even if there is only one tag/element in actual xml. Inner loop only runs once per outer loop’s iteration.

    To learn how to integrate the library visit

    http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to iPhone developer, I made epub reader and loaded each page
I am new to iPhone developer, I made epub reader and loaded each page
I am a new iPhone Application developer. I want to create an application which
i am new to iPhone developer, i am creating ePub reader for reading ePub
I am new in iPhone Developer so I want learn SQLite Database from begin
I am new to iPhone developer, How can i download the epub file from
I am new to iPhone developer, I am making Book Reader app, in which
I am new to iPhone developer, I want to implement different Animations on button
I am new to iPhone Developer. i want to do navigate to new page
I am new to iPhone developer, On click of button, i want to navigate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.