Hello I'm an Italian Student,I'm newbie for java programming.
I use Html parser for scanning all word of html parsing,but i can't scanning all line of html because it too long.
For example my code is :
public static void CreaNode(String url) throws ParserException{
Parser parser = new Parser(url);
Node Nodes [] = parser.extractAllNodesThatAre(Tag.class);
String [] listatag =new String [Nodes.length];
for (int i=0;i<Nodes.length;i++){
Node tag1= Nodes[i];
String tag ="";
tag = tag1.toString();
listatag[i] = tag;
//System.out.println(listatag[i]);
}
ControlTag("alt",listatag);
}
private static String CleanString(String controllo) {
//int index =controllo.indexOf(":");
//String pippo = controllo.substring(index+1,controllo.length());
String pippo = controllo;
return pippo;
}
private static void ControlTag(String searchtag, String[] listatag) {
int count = 0;
for (int i=0;i<listatag.length;i++){
count =count+1;
String controllo = listatag[i];
boolean b = controllo.matches("(?i).*"+searchtag+".*");
if (b==true) {
String pippo= CleanString(controllo);
System.out.println("Linea--> "+i+" "+pippo);
I want found all "alt" occurrences in html
but if It stay at the end of a line i don't find it because the end of the line is replaced by "..."
Can I scanning all length line?
Sorry for my English ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello I'm an Italian Student,I'm newbie for java programming.
I use Html parser for scanning all word of html parsing,but i can't scanning all line of html because it too long.
For example my code is :
public static void CreaNode(String url) throws ParserException{
Parser parser = new Parser(url);
Node Nodes [] = parser.extractAllNodesThatAre(Tag.class);
String [] listatag =new String [Nodes.length];
for (int i=0;i<Nodes.length;i++){
Node tag1= Nodes[i];
String tag ="";
tag = tag1.toString();
listatag[i] = tag;
//System.out.println(listatag[i]);
}
ControlTag("alt",listatag);
}
private static String CleanString(String controllo) {
//int index =controllo.indexOf(":");
//String pippo = controllo.substring(index+1,controllo.length());
String pippo = controllo;
return pippo;
}
private static void ControlTag(String searchtag, String[] listatag) {
int count = 0;
for (int i=0;i<listatag.length;i++){
count =count+1;
String controllo = listatag[i];
boolean b = controllo.matches("(?i).*"+searchtag+".*");
if (b==true) {
String pippo= CleanString(controllo);
System.out.println("Linea--> "+i+" "+pippo);
I want found all "alt" occurrences in html
but if It stay at the end of a line i don't find it because the end of the line is replaced by "..."
Can I scanning all length line?
Sorry for my English ...
Don't use toString() to get the string from the nodes, use toHtml() or toPlainTextString() instead.
toString() is just a programmers aid, and doesn't report the complete contents.