Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hiscore java code

Featured Replies

I am playing with java and by using a html parser was able to create a class that strips high score info in a simple text format seperated by a pipe: let me know what u think! I got the html parser code from

 

 

 

http://htmlparser.sourceforge.net/

 

 

 


/*

* Created on Jul 14, 2006

*

*/

package my.runescape;

import org.htmlparser.Node;

import org.htmlparser.Parser;

import org.htmlparser.nodes.TagNode;

import org.htmlparser.nodes.TextNode;

import org.htmlparser.tags.LinkTag;

import org.htmlparser.tags.TableColumn;

import org.htmlparser.tags.TableRow;

import org.htmlparser.util.NodeIterator;

import org.htmlparser.util.NodeList;

import org.htmlparser.util.ParserException;

/**

*/

public class FirstTest {



private StringBuffer list = new StringBuffer();



public static void main(String[] args) {

	FirstTest mine = new FirstTest();

	mine.start();

	System.out.println(mine.list.toString());

}



private void start() {

	Parser parser;

	try {

		parser = new Parser ("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=simeon_creel");

	    NodeIterator i = parser.elements (); 

	    while ((i.hasMoreNodes ())){

	    	this.processMyNodes(i.nextNode ());

	    }

	} catch (ParserException e) {

		// TODO Auto-generated catch block

		e.printStackTrace();

	}





}





/**

 */

private void processMyNodes(Node node) {

	// TODO Auto-generated method stub

     if (node instanceof TagNode)

     {

         // downcast to TagNode

         TagNode tag = (TagNode)node;     

         if(node instanceof TableRow){

         	// downcast to TableRow

         	TableRow tbRow = (TableRow)node;

         	if (tbRow.getColumnCount()>0) {

         		TableColumn[] tbCols = tbRow.getColumns();

         		for (int i = 0; i < tbCols.length; i++) {

	         		if (tbCols[i].getLastChild() instanceof LinkTag){

	         			LinkTag link = (LinkTag)tbCols[i].getLastChild();

	         			list.append("|"+link.getLinkText());

	         		}

		         	else if (tbCols[i].getLastChild() instanceof TextNode)

         		     {

         		         // downcast to TextNode

         		         TextNode text = (TextNode)tbCols[i].getLastChild();

         		         // do whatever processing you want with the text



         		         if (!text.getText().equalsIgnoreCase(" ")) list.append("|"+text.getText());

         		     }//end of else if

                }//end of For loop

         	}

         }

         NodeList nl = tag.getChildren ();

         if (null != nl){

             try {

				for (NodeIterator i = nl.elements (); i.hasMoreNodes(); )

				     processMyNodes (i.nextNode ());

			} catch (ParserException e) {

				// TODO Auto-generated catch block

				e.printStackTrace();

			}// End of Catch

         }// End of if null

     }// End of if node



    }//end of function



}

very interesting, uses the same methods as php curl I presume?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.