1

Re: XML Export does not escape ampersands

I've just noticed that if you run a report that includes taxon status Wildlife & Countryside Act Sch 8 (for example) and export to XML, the status is rendered as an attribute "Wildlife_&_Countryside_Act_Sch_8". The ampersand is illegal in XML and should be escaped, so the resulting XML without editing is unusable. This is probably fo minority interest, but it woudl be nice if it could be fixed at some point.

Alan

Alan Hale
Aberystwyth

2

Re: XML Export does not escape ampersands

There may be other ways, but you can certainly get round this by using a user defined funcion to return the date as text (in Recorder vague date format). A script for installinga suitable function is at www.lfield.co.uk/downloads/LCReturnVagueDateScript.zip. You will need to be able to insatll this via enterpise manager or similar.  To get the date in the query use something like this to call the function in your query.

dbo.LCVagueDateShort(sample.vague_date_start,sample.vague_date_end,sample.vague_date_type) as Vague date

Mike

Mike Weideli

3

Re: XML Export does not escape ampersands

I haven't been able to duplicate this. XML  is coming out OK for me. The following would work if you don't mind 'and' instead of the ampersand.
REPLACE is an inbuilt Transact SQL function and doesn't need a user defined function.

REPLACE(TAXON_DESIGNATION_TYPE.SHORT_NAME,'&',' and ') as NEW_NAME

The above gives 2 spaces where there is already an space befor and/or after the ampersand. The following gets around this problem.

REPLACE(REPLACE(TAXON_DESIGNATION_TYPE.SHORT_NAME,'&',' and '),'  ',' ') as NEW_NAME

Mike Weideli

4

Re: XML Export does not escape ampersands

Hi Mike

The XML is generated OK, but it's not well-formed because of the non-escaped ampersand. With me it generates an error if opened in a web browser, and I can't manipulate with XSLT.

"and" is fine and in fact for the purposes of testing I've just done a text "search and replace" to substitute the "&" with "and".

I'll try the method you suggest - many thanks.

Alan

Alan Hale
Aberystwyth