Je fais suite à un sujet ouvert pour interpréter un fichier html/css dans une fenêtre swing.
Sur les conseils adiGuba, je suis en train d'essayer Flying Saucer mais je rencontre un problème :
mais voilà l'erreur généré par Eclipse :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import org.xhtmlrenderer.simple.*; import javax.swing.*; public class test_class { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub // set up the xhtml panel XHTMLPanel xhtml = new XHTMLPanel(); xhtml.setDocument("http://google.fr"); JScrollPane scroll = new JScrollPane(xhtml); JFrame frame = new JFrame("Demo"); frame.getContentPane().add(scroll); frame.pack(); frame.setSize(500,600); frame.show(); } }
Me manque t'il une librairie ???
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 plumbing.render INFO:: Using CSS implementation from: org.xhtmlrenderer.context.StyleReference plumbing.load INFO:: SAX XMLReader in use (parser): com.sun.org.apache.xerces.internal.parsers.SAXParser plumbing.load INFO:: SAX XMLReader in use (parser): com.sun.org.apache.xerces.internal.parsers.SAXParser plumbing.load INFO:: SAX XMLReader in use (parser): com.sun.org.apache.xerces.internal.parsers.SAXParser plumbing.load INFO:: SAX XMLReader in use (parser): com.sun.org.apache.xerces.internal.parsers.SAXParser plumbing.load INFO:: SAX XMLReader in use (parser): com.sun.org.apache.xerces.internal.parsers.SAXParser plumbing.load INFO:: SAX XMLReader in use (parser): com.sun.org.apache.xerces.internal.parsers.SAXParser plumbing.load INFO:: The element type "meta" must be terminated by the matching end-tag "</meta>". ERROR: 'The element type "meta" must be terminated by the matching end-tag "</meta>".' plumbing.exception WARNING:: Unhandled exception. Can't load the XML resource (using TRaX transformer). org.xml.sax.SAXParseException: The element type "meta" must be terminated by the matching end-tag "</meta>". Exception in thread "main" org.xhtmlrenderer.util.XRRuntimeException: Can't load the XML resource (using TRaX transformer). org.xml.sax.SAXParseException: The element type "meta" must be terminated by the matching end-tag "</meta>". at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:191) at org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:71) at org.xhtmlrenderer.swing.NaiveUserAgent.getXMLResource(NaiveUserAgent.java:204) at org.xhtmlrenderer.swing.BasicPanel.loadDocument(BasicPanel.java:428) at org.xhtmlrenderer.simple.XHTMLPanel.setDocument(XHTMLPanel.java:153) at test_class.main(test_class.java:22) Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The element type "meta" must be terminated by the matching end-tag "</meta>". at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:721) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313) at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:189) ... 5 more Caused by: org.xml.sax.SAXParseException: The element type "meta" must be terminated by the matching end-tag "</meta>". at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:638) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:709) ... 7 more
Merci d'avance pour votre réponse.
Partager