W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2001

Html-Tidy BUG ???

From: Holger Prause <holger.prause@detewe.de>
Date: Tue, 12 Jun 2001 17:04:54 +0200
Message-ID: <3B262F96.31237A0E@detewe.de>
To: html-tidy@w3.org
Hi


i am using Jtidy(html tidy) to get a DOM out of some html files and then
i get all Links (all Elements with nodename "a").Now i want to take this
dom and want it to
process with XSLT

when i use the following Code  i get the following Exception

<pre>
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
        processor.process(new XSLTInputSource(doc),new
XSLTInputSource(new FileInputStream(xslPath)),
        new XSLTResultTarget(new FileOutputStream(outputFile)));
</pre>


XSL Error: Cannot use a DTMLiaison for a input DOM node... pass a
org.apache.xalan.xpath.xdom.XercesLiaison instead!

XSL Error: SAX Exception

org.apache.xalan.xslt.XSLProcessorException:
 at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1799)

 at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1691)

 atorg.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:919)

 at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:643)
 at DOMToHtmlSerializer.serialize(DOMToHtmlSerializer.java:39)
 at HtmlLinkValidator.validate(HtmlLinkValidator.java:56)
 at Main.<init>(Main.java:44)
 at Main.main(Main.java:55)


Ok i thought , if he want it that way i pass a xerces liasion

<pre>
XercesLiaison xl = new XercesLiaison();
        XSLTProcessor processor = XSLTProcessorFactory.getProcessor(xl);

        processor.process(new XSLTInputSource(doc),new
XSLTInputSource(new FileInputStream(xslPath)),
        new XSLTResultTarget(new FileOutputStream(outputFile)));
</pre>

than i get the following exception
XSL Error: SAX Exception

org.apache.xalan.xslt.XSLProcessorException: XercesLiaison can not
handle nodes of type class org.w3c.tidy.DOMDocumentImpl
 at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1753)

 at org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1717)

 at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:746)
 at DOMToHtmlSerializer.serialize(DOMToHtmlSerializer.java:39)
 at HtmlLinkValidator.validate(HtmlLinkValidator.java:56)
 at Main.<init>(Main.java:44)
 at Main.main(Main.java:55)


"
org.apache.xalan.xslt.XSLProcessorException: XercesLiaison can not
handle nodes of type class org.w3c.tidy.DOMDocumentImpl             "

Why is JTidy using its own DOMDocumentImpl(org.w3c.tidy.DOMDocumentImp)
and not the  DOMDocumentImpl from w3c(org.w3c.dom.DOMDocumentImp) ?? (

This would have saved my a lot of time



Now what can i do ?

Solution 1: write the tidy-dom to disk and the reparse it with any
xml-parser , and the process it

Solution 2.

write a wrapper wich changes the tidy-dom to an pure
org.w3c.dom.Document
and then process it

Solution 3 :
Search for another tool doing it


Hmm can anyone of u , especially the developers of this too / libraryl,
tell me what to do?
Received on Tuesday, 12 June 2001 11:03:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:45 GMT