Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Parsing character strings from websites.

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Parsing character strings from websites.

    Hey guys,

    I'm trying to write a java program to parse a character string as received from a web browser into its component parts. The url I want to parse is a simple form with name, age, etc. I cant write the parser to pull out the info in the forms or get strings to show the inputted data. Here is the source code of the site I want to use.

    <HTML>
    <HEAD>
    <TITLE> STUDENT BIO </TITLE>
    </HEAD>
    <BODY>
    <H3> BIO </H3>
    <OL>
    <LI>From Dentech.
    <LI>Major Mechanical Engineering.
    <LI>Plans to work for a robotics firm.
    <LI>Future goals to build a robot.
    </OL>
    <UL>
    <LI>Favorite game Persona 3 FES.
    <LI>Favorite TV show Gundam SEED Destiny.
    <LI>Hobbies building gundam models.
    </UL>
    </BODY>
    </HTML>


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,358
    Thanks
    182
    Thanked 834 Times in 777 Posts
    Blog Entries
    5

    Default Re: Parsing character strings from websites.

    What have you tried? Where are you stuck? Are you familiar with the String class? Regular expressions? We can only guess what help you need or what your experience is.

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Parsing character strings from websites.

    I guess its more of a string processing problem. I am fairly new to java.

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,358
    Thanks
    182
    Thanked 834 Times in 777 Posts
    Blog Entries
    5

    Default Re: Parsing character strings from websites.

    Quote Originally Posted by AT-LOW View Post
    I guess its more of a string processing problem. I am fairly new to java.
    You did not answer the first two questions. These forums are not a code service, so no one is going to do this for you. Thus, without knowing what you have tried or where exactly you are stuck, you don't leave us much in the way of helping aside from pointing you tutorials and the API
    Strings (The Java™ Tutorials > Learning the Java Language > Numbers and Strings)
    String (Java Platform SE 6)

  5. #5
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Parsing character strings from websites.

    I understand that people arent going to do this for me. I'd rather do it on my own so I can learn from it. I was trying to pull the seperate list items in HTML and put them ino java by the use of strings with out writing the info inmyself from the HTML. I wrote the HTML code but I dont know how to make java talk to it to take the info from it.



    EDIT: I got it finally! I used string splits with the url link. Thanks for the link to the string info.

  6. #6
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,358
    Thanks
    182
    Thanked 834 Times in 777 Posts
    Blog Entries
    5

    Default Re: Parsing character strings from websites.

    I wrote the HTML code but I dont know how to make java talk to it to take the info from it.
    For reading a webpage, you can use a URL and URLConnection( see Reading from and Writing to a URLConnection (The Java™ Tutorials > Custom Networking > Working with URLs) ). Once you then have the text, you can parse it using a variety of methods, some of which are alluded to above.

  7. #7
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Parsing character strings from websites.

    Thank you so much for your help! That tutorial was really handy.

Similar Threads

  1. Comparing a character to an array of strings
    By Hashmeer169 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 4th, 2011, 07:55 PM
  2. get vowel character from strings
    By siddiqui_1985 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 2nd, 2011, 04:30 AM
  3. Help with XML Parsing
    By ur2cdanger in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: October 1st, 2011, 08:58 AM
  4. Parsing XML
    By jrookie in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 17th, 2011, 11:04 AM
  5. The character '' is an invalid XML character exception getting
    By sumanta in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 9th, 2010, 12:13 PM