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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:54:14+00:00 2026-06-13T11:54:14+00:00

Possible Duplicate: Using an NSXMLParser to parse HTML I am trying to parse the

  • 0

Possible Duplicate:
Using an NSXMLParser to parse HTML

I am trying to parse the following XML data, but the structure is messed up and it doesn’t have closing tags. This is not an XML file I have made, but one I am trying to parse from a webserver.

    <FORM ACTION="/prod/bwckgens.p_proc_term_date" METHOD="POST" onSubmit="return checkSubmit()">
<INPUT TYPE="hidden" NAME="p_calling_proc" VALUE="bwckschd.p_disp_dyn_sched">
<TABLE  CLASS="dataentrytable" summary="This layout table is used for term selection."width="100%"><CAPTION class="captiontext">Search by Term: </CAPTION>
<TR>
<TD CLASS="dedefault"><LABEL for=term_input_id><SPAN class="fieldlabeltextinvisible">Term</SPAN></LABEL>
<SELECT NAME="p_term" SIZE="1"  ID="term_input_id">
<OPTION VALUE="">None
<OPTION VALUE="201320">Spring 2013
<OPTION VALUE="201315">STAR/BGR: New Admits Fall 2012 (View only)
<OPTION VALUE="201310">Fall 2012 (View only)
<OPTION VALUE="201230">Summer 2012 (View only)
<OPTION VALUE="201220">Spring 2012 (View only)
<OPTION VALUE="201210">Fall 2011 (View only)
<OPTION VALUE="201130">Summer 2011 (View only)
<OPTION VALUE="201120">Spring 2011 (View only)
<OPTION VALUE="201110">Fall 2010 (View only)
<OPTION VALUE="201030">Summer 2010 (View only)
<OPTION VALUE="201020">Spring 2010 (View only)
<OPTION VALUE="201010">Fall 2009 (View only)
<OPTION VALUE="200930">Summer 2009 (View only)
<OPTION VALUE="200920">Spring 2009 (View only)
<OPTION VALUE="200910">Fall 2008 (View only)
<OPTION VALUE="200830">Summer 2008 (View only)
<OPTION VALUE="200820">Spring 2008 (View only)
</SELECT>
</TD>
</TR>
</TABLE>
<BR>
<BR>
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</FORM>

There is a lot more to the HTML File, but I am only including what is relevant. I want to get all of the numbers OPTION VALUE="these numbers" and the Term following the bracket. e.g. Spring 2013.

How do I use the NSXMLParser to get these values since there is no closing tag. I tried printing out all of the elements the parser encounters by

NSLog(@"Current start element: %@\n", elementName);
NSLog(@"Current attr:%@\n", attributeDict.description);

but I don’t see OPTION or VALUE anywhere. This is the result from the NSLog statements:

2012-10-28 13:58:47.638 Purdue Course Finder[32890:c07] Current start element: HTML
2012-10-28 13:58:47.638 Purdue Course Finder[32890:c07] Current attr:{
    lang = en;
}
2012-10-28 13:58:47.639 Purdue Course Finder[32890:c07] Current start element: HEAD
2012-10-28 13:58:47.639 Purdue Course Finder[32890:c07] Current attr:{
}
2012-10-28 13:58:47.639 Purdue Course Finder[32890:c07] Current start element: META
2012-10-28 13:58:47.640 Purdue Course Finder[32890:c07] Current attr:{
    content = "text/html; charset=UTF-8";
    "http-equiv" = "Content-Type";
}
2012-10-28 13:58:47.640 Purdue Course Finder[32890:c07] Current start element: META
2012-10-28 13:58:47.640 Purdue Course Finder[32890:c07] Current attr:{
    CONTENT = "no-cache";
    "HTTP-EQUIV" = Pragma;
    NAME = "Cache-Control";
}
2012-10-28 13:58:47.641 Purdue Course Finder[32890:c07] Current start element: META
2012-10-28 13:58:47.641 Purdue Course Finder[32890:c07] Current attr:{
    CONTENT = "no-cache";
    "HTTP-EQUIV" = "Cache-Control";
    NAME = "Cache-Control";
}
2012-10-28 13:58:47.641 Purdue Course Finder[32890:c07] Current start element: LINK
2012-10-28 13:58:47.642 Purdue Course Finder[32890:c07] Current attr:{
    HREF = "/css/web_defaultapp.css";
    REL = stylesheet;
    TYPE = "text/css";
}
2012-10-28 13:58:47.642 Purdue Course Finder[32890:c07] Current start element: LINK
2012-10-28 13:58:47.642 Purdue Course Finder[32890:c07] Current attr:{
    HREF = "/css/web_defaultprint.css";
    REL = stylesheet;
    TYPE = "text/css";
    media = print;
}
2012-10-28 13:58:47.643 Purdue Course Finder[32890:c07] Current start element: TITLE
2012-10-28 13:58:47.643 Purdue Course Finder[32890:c07] Current attr:{
}
2012-10-28 13:58:47.643 Purdue Course Finder[32890:c07] Current end element: TITLE
2012-10-28 13:58:47.644 Purdue Course Finder[32890:c07] Current start element: META
2012-10-28 13:58:47.644 Purdue Course Finder[32890:c07] Current attr:{
    CONTENT = "text/javascript";
    "HTTP-EQUIV" = "Content-Script-Type";
    NAME = "Default_Script_Language";
}
2012-10-28 13:58:47.644 Purdue Course Finder[32890:c07] Current start element: SCRIPT
2012-10-28 13:58:47.645 Purdue Course Finder[32890:c07] Current attr:{
    LANGUAGE = JavaScript;
    TYPE = "text/javascript";
}
2012-10-28 13:58:47.645 Purdue Course Finder[32890:c07] Current end element: SCRIPT
2012-10-28 13:58:47.645 Purdue Course Finder[32890:c07] Current start element: SCRIPT
2012-10-28 13:58:47.646 Purdue Course Finder[32890:c07] Current attr:{
    LANGUAGE = JavaScript;
    TYPE = "text/javascript";
}
2012-10-28 13:58:47.646 Purdue Course Finder[32890:c07] Current end element: SCRIPT

I even tried printing everywhere in the - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string method. It does not find these tags anywhere. I was wondering if someone could help me parse this poorly constructed XML file. Thanks!

  • 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-13T11:54:15+00:00Added an answer on June 13, 2026 at 11:54 am

    Its looks to me like you’re not even getting to the main chunk of data you’re interested in, possibly because the HEAD is malformed as well (though I don’t know for sure since that part of the document isn’t included in the question).

    I would suggest making subtle tweaks to the document after it is received until it processes correctly. You don’t have to fix every error, just the ones that prevent you from getting to your option data. Once you know the fixes required, do some automatic replace/regexing after the file is received and process normally.

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

Sidebar

Related Questions

Possible Duplicate: Using NSXMLParser with CDATA Im using NSXMLParser to parse xml data from
Possible Duplicate: Using a bitwise & inside an if statement I have the following
Possible Duplicate: Using LibTiff in Visual Studio 2010 I have been trying to work
Possible Duplicate: Parsing XML in Cocoa iPhone - Can we parse .plist(xml) file using
Possible Duplicate: Using delegate() with hover()? I am trying this code, but apparently I
Possible Duplicate: Using VFP/Neon for a Visual Studio 2008 application I have built a
Possible Duplicate: Using ApplicationSettings to store Checked property for WinForms RadioButtons I have three
Possible Duplicate: Converting XML to JSON using Python? I am importing an XML feed
Possible Duplicate: Using C# regular expressions to remove HTML tags Extract Content from Div
Possible Duplicate: Using IoC for Unit Testing I think I do have a Problem

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.