W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2002

[patch] plugin support for JTidy

From: Ryan Breen <ryan@porivo.com>
Date: Thu, 21 Feb 2002 10:30:31 -0500 (EST)
To: sami@lempinen.net, html-tidy@w3.org
Message-Id: <200202211024.23690.ryan@porivo.com>

We (http://www.porivo.com) are adding JavaScript support to our web testing 
software using the Rhino parser from the Mozilla project 
(http://www.mozilla.org/rhino/doc.html).  Since browsers parse JavaScript 
inline with HTML, we needed the ability to view each Node as it is generated 
by Tidy.  And since document.write can generate dynamic content that must be 
parsed before the remaining HTML in the buffer, we also needed the ability to 
prepend content to the HTML stream.

I have made a few additions to the Tidy package to allow this integration.  
The patch includes two new files and about 10 new lines of code in 
org.w3c.tidy.Node.java and org.w3c.tidy.StreamInImpl.  The patch does not 
introduce any new dependencies and should have a negligible performance 
impact in the average case.

While we use these modifications to add JavaScript support, there are a number 
of other possible applications for the expanded ability to interact with Tidy 
at parse time.

Implementation details:

I added a NodeHandler interface to the org.w3c.tidy package which specifies a 
method for viewing and manipulating Nodes and a method for returning dynamic 
content to prepend to the stream.  The NodeHandlerStore class is a Singleton 
that manages registration of NodeHandler implementations.

I modified Node.insertNodeAtEnd(Node element, Node node) to send the nodes to 
all NodeHandler implementations.  I also modified 
StreamInImpl.readCharFromStream to check all NodeHandler implementations for 
any buffered dynamic content before reading from the HTML stream.

Let me know if you have any questions.

Thanks,
Ryan

Ryan Breen
Porivo Technologies, Inc.
919.806.0566  |  ryan@porivo.com
www.porivo.com

Measuring end-to-end Web performance.

Register for a FREE Performance appraisal:
http://www.porivo.com/peerReview/eval.html

Received on Monday, 25 February 2002 10:10:54 GMT

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