ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Bug 25564 - CVS tagdiff does not escape XML characters
Date Tue, 16 Dec 2003 18:21:16 GMT
Server is down at the moment, so I cannot add to

Hi All,

I have been looking through the problem source and the XML is generated by 
hand with code like

            writer.print("<tagdiff ");
            if (mystartTag != null) {
                writer.print("startTag=\"" + mystartTag + "\" ");
            } else {
                writer.print("startDate=\"" + mystartDate + "\" ");
            if (myendTag != null) {
                writer.print("endTag=\"" + myendTag + "\" ");
            } else {
                writer.print("endDate=\"" + myendDate + "\" ");

Which is all quite nasty. 

Firstlly, the problem could be fixed by adding a CDATA to the offending 
text, but this still leaves potential problems.

My favoured way of generating XML from a class is to extend XMLFilterImpl 
and fire SAX events to a Transformer with no stylesheet and StreamResult 
of the required output file, inspired by Cocoon 2.

Given that frequently the XML output of this task would be transformed to 
HTML using taggdiff.xsl then the processing would be more efficient to use 
that transformer from the outset; this would of course have to be optional 
in order not to break existing build files.

The cvschangelog task is also guitly of handcrafting XML albeit using a 
CDATA for certain elements, again this task is also frequently followed by 
a style task.

CvsTagDiff extends AbstractCvsTask yet ChangeLogTask does not, but both 
tasks are very similar, i.e:

        execute cvs command
        parse resultant file to memory
        output memory contents to XML

And are both frequently followed by a style task, such similarity IMO 
should be exploited.

Anyway, I am new to this open source apache stuff so appologies if I have 
omitted and stages or information. I am happy to perform this work myself 
of course.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message