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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:20:09+00:00 2026-05-26T09:20:09+00:00

I have a tag <AboutUs> (having HTML tags) and I have stored the string

  • 0

I have a tag <AboutUs> (having HTML tags) and I have stored the string part in a local string. Now I want to pass it to my webView to display, but it is showing my string (null).

Here’s my code, any help is appreciated:

@class AppDelegate_iPhone;
@interface AboutUsViewController : UIViewController<NSXMLParserDelegate> {

    NSMutableString *aboutUsString;
    NSString *currentElement;

    IBOutlet UIWebView *webView;
    AppDelegate_iPhone *appDelegate;
}

@property(nonatomic,retain) NSMutableString *aboutUsString;
@property(nonatomic,retain) IBOutlet UIWebView *webView;
-(id)init;

@end



@implementation AboutUsViewController
@synthesize aboutUsString,webView;


-(id)init{
    if(self == [super init]){
        aboutUsString = [[NSMutableString alloc]init];
    }
    return self; 
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

    appDelegate = (AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate];

    NSURL *url = [[NSURL alloc] initWithString:@"http://mobileecommerce.site247365.com/admin/AboutUs.xml"];
    NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];

    //Initialize the delegate.
    AboutUsViewController *parser = [[AboutUsViewController alloc] init];

    //Set delegate
    [xmlParser setDelegate:parser];

    //Start parsing the XML file.
    BOOL success = [xmlParser parse];

    if(success)
        NSLog(@"No Errors");
    else
        NSLog(@"Error Error Error!!!");

    NSLog(@"After Parsing=== = = = = = = = == = = = = %@",appDelegate.TextString);



}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
    [super viewDidUnload];
}

- (void)parserDidStartDocument:(NSXMLParser *)parser
{

}


- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
    currentElement = elementName;

    if([currentElement isEqualToString:@"AboutUs"]) {

    }

}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
    if([currentElement isEqualToString:@"AboutUs"]) {

        NSMutableString *outputBuilder =  [[NSMutableString alloc]init] ;

        [outputBuilder appendString:[NSString stringWithFormat:@"%@", self.aboutUsString]];

        [outputBuilder appendString:[NSString stringWithFormat:@"%@", string]];

        self.aboutUsString = outputBuilder;

        [outputBuilder release];

    }
    else 
    {
        self.aboutUsString = string;
    }



}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
    if([elementName isEqualToString:@"AboutUs"]) {

        [webView setScalesPageToFit:YES];
        [webView loadHTMLString:self.aboutUsString baseURL:[NSURL URLWithString:@"http://www.hitchhiker.com/message"]];

        NSLog(@"In DID End Element ===== %@",aboutUsString);

        appDelegate.TextString = [[NSMutableString alloc]initWithString:aboutUsString];

    }

    currentElement = @"";
}



- (void)parserDidEndDocument:(NSXMLParser *)parser
{
    NSLog(@"In Document End =========  %@",aboutUsString);

    NSLog(@"Appdelgate Text String %@",appDelegate.TextString);


}

- (void)dealloc {
    [super dealloc];
    [webView release];
}


@end
  • 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-05-26T09:20:09+00:00Added an answer on May 26, 2026 at 9:20 am

    In your viewDidLoad method, you’re creating a new AboutUsViewController which then gets all the NSXMLParser delegate calls. It has its own web view, that one will load the parsed HTML, but you’ll never see it because the parsing view controller is never actually visible.

    You should set self as the xml parser’s delegate instead of creating a new instance.

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

Sidebar

Related Questions

I have the following tag with a Html.TextBoxFor expression and I want the contents
I have XML tag that has the content which is HTML document. <xml-tag> <!--
Say I have file A, in middle of which have a tag string #INSERT_HERE#.
I have used fieldset tag in HTML page, whereby i need some text to
I have a HTML Tag <textarea>$FOO</textarea> and the $FOO Variable will be filled with
I have div tag inside body html: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
How do people test jsp 2.0 tags? The ones that have .tag extensions and
For example I have a html string: <span class=no>1172</span><span class=r>case</span> primary_key_prefix_type How to wrap
I have this tag in a php string: <input type=submit name=op id=edit-submit value=Log in
I have a tag in my html like this: <h1>My Website Title Here</h1> Using

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.