[fpc-devel] fpcUnit generates invalid XML

Graeme Geldenhuys graemeg.lists at gmail.com
Sun May 28 12:36:27 CEST 2006


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.

Regards,
  Graeme.


-- 
There's no place like 127.0.0.1


More information about the fpc-devel mailing list