Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-05

fpcUnit generates invalid XML

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

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

Reply by email

Dean Zobec
to Graeme Geldenhuys
Graeme Geldenhuys wrote 40 lines
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

Reply by email

Graeme Geldenhuys
to Dean Zobec

Hi Dean,

Okay, I will start implementing option 2 and send a patch.

PS:
I will look at your patch you send tomorrow.

Graeme.

Dean Zobec wrote 53 lines
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 _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel
There's no place like 127.0.0.1

Reply by email