Selecting HTML elements, then adding HTML elements
in
Programming Questions
•
2 years ago
Hello all,
I am using JSoup to select the HTML elementsin a HTML docment, and then trying to add an element.
However, looking through the examples on the net, I am unable to make all the connections, and thus have errors thrown by my code.
I wish to isolate the "start" in:
<h1 name="start">A Book on the Fringe of Telecommunications</h1>
and then add "<a href="start"></a>" after it, for the result:
<h1 name="start">A Book on the Fringe of Telecommunication</h1><a href="start"></a>
My code, which runs but doesn't work, looks like this:
void draw() {
background(153);
Document doc = Jsoup.parse("/home/boris/Sketchbook/data/fringe.html", "UTF-8");
Elements start = doc.select("start");
for (Element starts : start) {
start.append("<a href\"start\"></a>");
}
}
Any help would be appreciated...! Thanks!
I am using JSoup to select the HTML elementsin a HTML docment, and then trying to add an element.
However, looking through the examples on the net, I am unable to make all the connections, and thus have errors thrown by my code.
I wish to isolate the "start" in:
<h1 name="start">A Book on the Fringe of Telecommunications</h1>
and then add "<a href="start"></a>" after it, for the result:
<h1 name="start">A Book on the Fringe of Telecommunication</h1><a href="start"></a>
My code, which runs but doesn't work, looks like this:
void draw() {
background(153);
Document doc = Jsoup.parse("/home/boris/Sketchbook/data/fringe.html", "UTF-8");
Elements start = doc.select("start");
for (Element starts : start) {
start.append("<a href\"start\"></a>");
}
}
Any help would be appreciated...! Thanks!
1