Note that there are some explanatory texts on larger screens.

plurals
  1. POFetch table of contents from html page in iPhone
    primarykey
    data
    text
    <p>I am new to iPhone developer,</p> <p>I made epub reader for my application, in which i want to fetch all the value of <code>&lt;text&gt;</code> tag from my local <code>.html</code> page and i want to store it in my array.</p> <p><strong>For eg:</strong> This is my <code>toc.html</code> file, from this file i want to fetch all the value of <code>&lt;text&gt;</code> tag, </p> <pre><code>&lt;navMap&gt; &lt;navPoint class="chapter" id="navpoint-1" playOrder="1"&gt; &lt;navLabel&gt; &lt;text&gt;Cover&lt;/text&gt; &lt;/navLabel&gt; &lt;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"/&gt; &lt;/navPoint&gt; &lt;navPoint class="chapter" id="navpoint-2" playOrder="2"&gt; &lt;navLabel&gt; &lt;text&gt;News&lt;/text&gt; &lt;/navLabel&gt; &lt;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"/&gt; &lt;/navPoint&gt; &lt;navPoint class="chapter" id="navpoint-3" playOrder="3"&gt; &lt;navLabel&gt; &lt;text&gt;Report&lt;/text&gt; &lt;/navLabel&gt; &lt;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"/&gt; &lt;/navPoint&gt; &lt;navPoint class="chapter" id="navpoint-4" playOrder="4"&gt; &lt;navLabel&gt; &lt;text&gt;Economy Update&lt;/text&gt; &lt;/navLabel&gt; &lt;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"/&gt; &lt;/navPoint&gt; &lt;navMap&gt; </code></pre> <p>finally my array should have: </p> <pre><code>array at 0: Cover array at 1: News array at 2: Report array at 3: Economy Update </code></pre> <p><strong>EDIT:</strong></p> <pre><code>- (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&lt;[TOCArray count]; i++) { NSLog(@"Toc array=%@",[TOCArray objectAtIndex:i]); } } </code></pre> <p>My log Shows: <code>Path of my file=/Users/krunal/Library/Application Support/iPhone Simulator/5.0/Applications/D414BC19-C005-4D93-896D-A6FB71DE4D21/Documents/UnzippedEpub/toc.ncx</code></p> <p>but my array is still null.</p> <p>here is my <code>toc.ncx</code> file <a href="http://www.mediafire.com/?4r883s80he23cua" rel="nofollow">http://www.mediafire.com/?4r883s80he23cua</a></p> <p><strong>NEW EDIT</strong></p> <pre><code>2012-07-23 16:07:50.522 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96480: {type:1 name:text xml:"&lt;text&gt;Cover&lt;/text&gt;"} 2012-07-23 16:07:50.522 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96610: {type:1 name:text xml:"&lt;text&gt;News&lt;/text&gt;"} 2012-07-23 16:07:50.523 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96730: {type:1 name:text xml:"&lt;text&gt;Report&lt;/text&gt;"} 2012-07-23 16:07:50.523 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96850: {type:1 name:text xml:"&lt;text&gt;Economy Update&lt;/text&gt;"} 2012-07-23 16:07:50.524 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96970: {type:1 name:text xml:"&lt;text&gt;Other Factors&lt;/text&gt;"} 2012-07-23 16:07:50.524 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96aa0: {type:1 name:text xml:"&lt;text&gt;Result Update&lt;/text&gt;"} 2012-07-23 16:07:50.525 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96bc0: {type:1 name:text xml:"&lt;text&gt;Result Update (Continued)&lt;/text&gt;"} 2012-07-23 16:07:50.526 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96ce0: {type:1 name:text xml:"&lt;text&gt;Trends in NIM&lt;/text&gt;"} 2012-07-23 16:07:50.526 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96e00: {type:1 name:text xml:"&lt;text&gt;Key Stats&lt;/text&gt;"} 2012-07-23 16:07:50.527 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a96f40: {type:1 name:text xml:"&lt;text&gt;Result Update&lt;/text&gt;"} 2012-07-23 16:07:50.527 iBook [2105:fe03] Toc array=GDataXMLElement 0x6a97060: {type:1 name:text xml:"&lt;text&gt;Disclaimer&lt;/text&gt;"} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload