Matching HTML tags in Processing
in
Programming Questions
•
2 years ago
Hello all,
The program I'm trying to write is meant to match the "</h1>" tag in a HTML file. Of course, more functionality is planned, I need to add anchors after the "</h1>" tag, write that to a table of contents file, then export that to an XML file - but all in its good time.
At the moment, I'm simply trying to match the tags in the file. The file is accessed by an Open File dialog, and that seems to work fine. Surprising, I would've thought that much more complex. Anyway, I'll post my code, which gives me a "duplicate local varible" error - is there an easy way around this...?
public void xmlGenerate() {
String bookfile[] = loadStrings(bookfile1);
String []bookfile = match(bookfile1, n);
for (int i = 0; i < m.length; i++) {
println("Found " + m[i][1] + " inside a tag.");
}
}
I'm sure I'm missing the point of this, but my searches for an example of match/ matchall usage has so far proved fruitless.
The program I'm trying to write is meant to match the "</h1>" tag in a HTML file. Of course, more functionality is planned, I need to add anchors after the "</h1>" tag, write that to a table of contents file, then export that to an XML file - but all in its good time.
At the moment, I'm simply trying to match the tags in the file. The file is accessed by an Open File dialog, and that seems to work fine. Surprising, I would've thought that much more complex. Anyway, I'll post my code, which gives me a "duplicate local varible" error - is there an easy way around this...?
public void xmlGenerate() {
String bookfile[] = loadStrings(bookfile1);
String []bookfile = match(bookfile1, n);
for (int i = 0; i < m.length; i++) {
println("Found " + m[i][1] + " inside a tag.");
}
}
I'm sure I'm missing the point of this, but my searches for an example of match/ matchall usage has so far proved fruitless.
1