August 19, 2003 at 4:23 am
I have a stored procedure that outputs an article in XML for use within our .Net publishing system. This has worked fine until an odd character was input into one of the articles.
The SP outputs the xml fine, but when this XML is used in either a XMLReader or loaded into Internet Explorer then it finds an invalid character. If I add
<?xml version="1.0" encoding="ISO-8859-1"?>
To the start of the file and load it into Internet Explorer then it loads fine, I am unable to add this to the XMLReader though as the XMLReader is populated directly from the Stored Procedure.
I have searched both googld and MSDN and am unable to find a way of adding headers to the output of a FOR XML query. Anyone have any ideas?
(The text item in question is being output as a CDATA item)
Dan
August 22, 2003 at 8:00 am
This was removed by the editor as SPAM
August 25, 2003 at 3:59 am
I dont think you can modify it. Im surprised CDATA didnt handle it. What char? How about fixing it with a replace in the proc?
Andy
August 25, 2003 at 7:28 pm
Hi there
I dont think this will help but...
By default SQL Server 2k FOR XML is UTF-8 encoded. The developer should also take into consideration the ADO command objects being used, namely correct using of stream objects and FSO to ensure the XML string blobs are not re-encoded/altered in any way.
What may be happening in your case may be related to the streaming object itself and if the XML is being re-encoded. Check the XML carefully for the interpretation of the special characters.
Take a look here as well: http://www.w3schools.com/xml/xml_encoding.asp
Cheers
Ck
Chris Kempster
Author of "SQL Server 2k for the Oracle DBA"
Chris Kempster
www.chriskempster.com
Author of "SQL Server Backup, Recovery & Troubleshooting"
Author of "SQL Server 2k for the Oracle DBA"
August 26, 2003 at 2:16 am
Yes, I think it was something to do with the stream objects. I changed from using a XMLreader to a Textreader and then passing that through my XSL and it worked ok.
P.S. couldnt do a replace in the sproc becasue it was on a TEXT column and you cannot do a replace on that type of column (Wish you could!!)
Cheers All,
Dan
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply