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 8006631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:34:36+00:00 2026-06-04T17:34:36+00:00

i am using javascript program in http://zaldzbugz.posterous.com/how-to-search-a-string-inside-uiwebview to parse the html page and the

  • 0

i am using javascript program in http://zaldzbugz.posterous.com/how-to-search-a-string-inside-uiwebview to parse the html page and the following method

-(void)speakText:(NSString *)text
{


    NSString *filePath  = [[NSBundle mainBundle] pathForResource:@"UIWebViewSearch" ofType:@"js" inDirectory:@""];
    NSData *fileData    = [NSData dataWithContentsOfFile:filePath];
    NSString *jsString  = [[NSMutableString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
    text =jsString;
    NSMutableString *cleanString;
    cleanString = [NSMutableString stringWithString:@""];
    if([text length] > 1)
    {
        int x = 0;
        while (x < [text length])
        {
            unichar ch = [text characterAtIndex:x];
            [cleanString appendFormat:@"%c", ch];
            x++;
        }
    }
    if(cleanString == nil)
    {   // string is empty
        cleanString = [NSMutableString stringWithString:@""];
    }
    sound = flite_text_to_wave([cleanString UTF8String], voice);
    NSArray *filePaths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *recordingDirectory = [filePaths objectAtIndex: 0];
    // Pick a file name
    NSString *tempFilePath = [NSString stringWithFormat: @"%@/%s", recordingDirectory, "temp.wav"];
    // save wave to disk
    char *path; 
    path = (char*)[tempFilePath UTF8String];
    cst_wave_save_riff(sound, path);
    // Play the sound back.
    NSError *err;
    [audioPlayer stop];
    audioPlayer =  [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:tempFilePath] error:&err];
    [audioPlayer setDelegate:self];
    //[audioPlayer prepareToPlay];
    [audioPlayer play];
    // Remove file
    [[NSFileManager defaultManager] removeItemAtPath:tempFilePath error:nil];
    delete_wave(sound);

}

to convert text to speech the string input., i am hearing some encoded format in text field instead of html text (and when i did NSLog(jsstring) i got the whole javascript code and i guess its same in speech output ) .
as i am having very short time to solve , please help me out…
Thanks in advance..

  • 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-04T17:34:39+00:00Added an answer on June 4, 2026 at 5:34 pm

    Your code converts the JavaScript file to speech, at no point in your code you load an HTML file, let alone filter text out of it. I also doubt that the JavaScript program you refer to can actually help you achieve that, to me it looks only suitable to find and highlight parts of the text on the page that you already know.

    I would recommend you to look into NSScanner (Apple docs), you can use it to filter the HTML file for the relevant bits without using an external JavaScript program. It will take some fiddling though. If you have perfect HTML, an NSXMLParser would be a simpler solution, but I am not sure if you can rely on that. There might be ready-made solutions with third-party frameworks, but unfortunately I can’t advise you on this. This question on Stack Exchange might also be helpful: extract the text only from html content in objective C

    Regardless of the HTML parsing, there are some strange things going on in your code anyway. For example, why do you take (NSString *) text as a parameter for your speakText: method, when you overwrite text four lines later without ever touching it? And why the cumbersome character-by-character copying of text into cleanString?

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

Sidebar

Related Questions

The program is supposed to be a live search using php and javascript... where
I am working on a program using python, HTML and javascript. I have two
im having a setback, im making an Html page with javascript, and im using
using Javascript, it is easy to programatically select the text inside a textarea or
Using javascript, how do I add some data to the query string? Basically I
Using JavaScript, how do I create an HTML table that can "accept" numeric matrix
According to articles like: http://www.oreillynet.com/onjava/blog/2007/06/easy_ajax_with_struts_2.html and http://www.firstpartners.net/kb/index.php/Easy_Ajax_using_Struts_2 it should be easy (out of the
I usually script/program using python but have recently begun programming with JavaScript and have
i have this html and javascript program code for log in window. my html
I am using a counter plugin for jquery (http://wplayground.comuv.com/counter/) and have it implemented successfully

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.