name
Url
import prohtml.*;

HtmlTree htmlTree;

void setup(){
  //enter your url here
  htmlTree = new HtmlTree("http://www.yoururl.com");

  ArrayList links = htmlTree.getLinks();

  for(int i = 0;i<links.size();i++){
    println("**********************************************");
    println("Url_"+nf(i,3)+" : "+
      ((Url)(links.get(i))).toString());
    println(" getCompleteUrl: "+
      ((Url)(links.get(i))).getCompleteUrl());
    println(" getDomain : "+
      ((Url)(links.get(i))).getDomain());
    println(" getParentPart : "+
      ((Url)(links.get(i))).getParentPart());
    println(" getUrl : "+
      ((Url)(links.get(i))).getUrl());
    println(" isAbsolute : "+
      ((Url)(links.get(i))).isAbsolute());
  }
}
description
This class is to keep an url. It stores if an url is absolute or relative. It also stores the parentpart of an url, so it is possible to get the complete Part.
constructors
Url(url, parentPart);
Url(url, parentPart, domain);
parameters
url
String, part that is given from a link in a html page
parentPart
String, part that is added by proHTML for the case the url is relative
domain
String, the domain part of an url
methods
Compares two url. Returns 0 if the two urls are equal.
Overwrites the equals function to make sure when two Urls are equal.
Gives back the complete url, no matter if it is absolute or relative.
Gives back the domain of the site.
Gives back the parent url part. If the url is absolute it just returns an empty String ("").
Gives back the url stored in this object. If the domain is absolute you get the complete url, if it is relative you get the relative part
Gives back true if the url is absolute, false if it is realtive
Gives back the seperated parentPart and url part. Use getCompleteUrl to get the real url.
usage
Web & Application
related