Dan Mackey On ColdFusion Development

ColdFusion, Java, .NET, AJAX, DHTML development and general programming. Daniel is owner and Administrator of CFTagStore.com and works for an Application Development Company in Ireland called Digital Crew. His interests cover all areas of programming in multiple languages with a particular interest in Internet Technologies.

All Articles tagged : CFX_CompareHTML
2009-01-15 19:57:00.0

CompareHTMLComponent : JAR to compare two HTML fragments

After my initial post yesterday CFX_CompareHTML ColdFusion HTML diff custom tag I got quite a bit of feedback and one of the items raised was that some people dont like CFX tags and I should use JavaLoader to use the JAR file from within ColdFusion. (Thanks Dan Vega)

I have uploaded a JAR file called CompareHTMLComponent which allows you to do this.

To call the diff component use the following:

<cfset paths = arrayNew(1)>
<cfset paths[1] = expandPath("CompareHTMLComponent.jar")>
<cfset loader = createObject("component", "javaloader.JavaLoader").init(paths)>
<cfset compareComponent = loader.create("CompareHTMLComponent")>
<cfset diff = compareComponent.init()>

<cfoutput>#diff.compare("Some HTML","Some more HTML")#</cfoutput>

As always, feedback is most appreciated so hit me with your thoughts in the comments!

The JAR file and examples can be downloaded from here :

DOWNLOAD PACKAGE

Requires Java 1.5 JRE to be installed or it will throw an exception! ColdFusion 8 & Railo 3 should have this but CFMX7 may not.

Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [19] - Leave a comment
2009-01-14 14:29:00.0

CFX_CompareHTML ColdFusion HTML diff custom tag

Following on from my last post I have released Version 1 of my ColdFusion HTML Diff Custom Tag, CFX_CompareHTML.

When we wrote Teamwork Project Manager one of my jobs was to compare versions of Notebooks which were marked up using HTML.

I did lots of searching and found Diff.cfc which did a line for line comparison but did not represent the changes in HTML format, it only output the differences line-by-line with all the HTML viewable.

Diff.cfc is perfect for text or source code but we needed something a little bit more user-friendly.

A great start on this was DaisyDiff,  a Java library that diffs (compares) HTML files.

The problem with this was that I had to use CFExecute and some timeouts, writing to the drive etc to get some results. It soon became a nightmare on large files so I decided the best thing to do was to build a CFX tag around the main components of DaisyDiff.

CFX_CompareHTML was born.

You can call the tag using :

<cfx_CompareHTML left="Some HTML content" right="Some more HTML Content">

The tag can be downloaded from here :

DOWNLOAD CFX_COMPAREHTML

Add to your del.icio.us    DIGG This!    Technorati Cosmos Link    Post to Reddit    Add to your Furl    Add to Blinklist
Comments [8] - Leave a comment