[fpc-devel] fpcUnit generates invalid XML

Dean Zobec dean.zobec at gmail.com
Sun May 28 13:56:55 CEST 2006


Graeme Geldenhuys wrote:
> Hi Dean and others,
> 
> I have setup a nightly build server for the tiOPF framework and want
> to generate a "Last Build Status" page on my web server.  I started by
> creating a XSL file that will translate the XML file generated by the
> Text Runner, when I noticed that the XML generated is not valid as it
> contains reserved charaters in the node text.
> 
> Example:
> 
>  <message>[SETUP] Persistence layer not loaded <TAB></message>
> 
> or a more common one.
> 
>  <message>Failed on 4 expected: <$ 0.01> but was: <$ 0.00></message>
> 
> 
> The < and > characters are not allowed, so I can't parse it with XSLT.
> 
> 
> I can see thee solutions for this.
> 
> 1)  I have a Resevered Character Translator for XML, CSV and TAB files
> that I used in another project that I can build into the TestReport
> unit.  It has no other dependencies, but gives us a option to output
> test results to CSV or TAB files without having to worry about
> reserved words as well.
> 
> 2) Use the XMLWrite unit (that comes with FPC) which automatically
> generates the correct text when resevered characters are detected.
> The bonus, is that it generates indented XML as well which makes it
> easier to read for humans (though this is not a major issue).  We will
> have added dependency on the XML units, but is that such a bad thing
> as the XML units come with FPC as well.
> 
> 3) Wrap all node text in CDATA tags, but I really don't like this idea!
> 
> 
> I think the best option is to use option 2.  What do others think.
> Either way, I am willing to make the changes required.

Option 2 is the most appropriate I guess. Anyway you can also remove the
 characters that give problems and substitute them with others.
I'll also read some material about the automation of execution of tests
in JUnit to be able to build a good framework for the batch execution of
tests. I've seen a lot of material available.

Ciao, Dean



More information about the fpc-devel mailing list