Bonjour à tous

J'utilise nekohtml pour " convertir" un fichier html en xml valide.

il me génère par example ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 <?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE ns0:html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ns0:html xmlns:ns0="http://www.w3.org/1999/xhtml">
    <ns1:head xmlns:ns1="http://www.w3.org/1999/xhtml">
        <ns2:title xmlns:ns2="http://www.w3.org/1999/xhtml">test</ns2:title>
    </ns1:head>
    <ns3:body xmlns:ns3="http://www.w3.org/1999/xhtml">
    <ns4:h1 xmlns:ns4="http://www.w3.org/1999/xhtml">
        Hello world !!!
    </ns4:h1>
 
</ns3:body>
</ns0:html>
maintenant je voudrais parser, donc récupérer les valeurs texte (test et hello world !!!)

comment puis-je faire pour recupérer les valeurs sachant que j'utilise DOM

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
     public ParserHtml()
    {
        try
        {
            this.factory = DocumentBuilderFactory.newInstance();
            this.builder = factory.newDocumentBuilder();
            this.document = builder.parse(new File("D:\\out.xml"));
            this.element = document.getDocumentElement();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
Merci a tous.