name
childNumbToWeight ( )
import prohtml.*;

HtmlTree htmlTree;

void setup(){
  //enter your url here
  htmlTree = new HtmlTree("http://www.yoururl.com");
  println("Weight of the body: " + 
    htmlTree.childNumbToWeight(htmlTree.pageTree.countAllChildren()));
}
description
This method converts the number of descendants of an element of the HTML document, into a float value between 1 and 20. The values result from taking the number of all descendants from each element. Now the programm takes all different values and spreads them over the range from 1 to 20.
For example the values 1234, 444, 344, 322, 234, 233, 232, 230,44,33 would result in the following values: 1.0, 2.9, 4.8, 6.7, 8.6, 10.5, 12.4, 14.299999, 16.2, 18.099998.
So the exponentially increasing numbers of descendants are changed into proportionally growing float values.
syntax
childNumbToWeight(childNumb);
parameters
childNumb
int, the number of childs
returns
float, the weight for the number of childs
usage
Web & Application
related