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

Re: Html-Tidy BUG ???

From: Gary L Peskin <garyp@firstech.com>
Date: Mon, 18 Jun 2001 22:43:35 -0700
Message-ID: <3B2EE687.114DFE4F@firstech.com>
To: Holger Prause <holger.prause@detewe.de>
CC: html-tidy@w3.org
Holger --

First, you are using an old version of XalanJ.  I would recommend
upgrading to the current version as soon as you can.  The old version
requires a Liaison class and none has been constructed for Tidy that I
know of.  A XercesLiaison will not work with the JTidy DOM.

Second, I've explained how the Tidy DOM works in another email.  It
builds its own nodes which are wrapped with a small set of small DOM
interface classes.  You ask why we don't use the W3C implementation
classes
like org.w3c.dom.DOMDocumentImp.  The fact is that there are no W3C
implementation classes as far as I know.  The w3c simply provides
interfaces here, not concreate implementations.

For now, you're sort of stuck with your solution 1.

HTH,
Gary

Holger Prause wrote:
> 
> 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, 19 June 2001 01:44:07 GMT

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