Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

tag texte html

2 réponses
Avatar
remy
bonjour

savez vous si l'on peut créer ses propres tag html
un boot de code récupéré et modifié


import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.text.AttributeSet;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.parser.ParserDelegator;
import javax.swing.text.html.*;

public class Main{
public static void main(String args[]) throws Exception {
System.setProperty ("http.agent","lynx (compatible; MSIE 6.0; linux)");

URL url= new
URL("http://www.google.fr/search?hl=fr&q=coucou&btnG=Recherche+Google&meta=");
URLConnection connection = url.openConnection();
InputStream is = connection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
HTMLEditorKit htmlKit = new HTMLEditorKit();
HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
HTMLEditorKit.Parser parser = new ParserDelegator();
HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0);
HTMLDocument.Iterator iterator;
parser.parse(br, callback, true);



for ( iterator = htmlDoc.getIterator(HTML.Tag.A);
iterator.isValid(); iterator.next()) {
AttributeSet attributes = iterator.getAttributes();
String srcString = (String)
attributes.getAttribute(HTML.Attribute.HREF);
System.out.println(srcString);
}
System.exit(0);
}
}

en gros j'ai essayé mais cela ne donne rien merci

remy

2 réponses

Avatar
remy
Avatar
Côme Desplats
remy wrote:
oops


Autrement dans ton lecteur de news il y a une fonction pour annuler un
message.