Re: XML Data Type - Illegal Characters
  Home FAQ Contact Sign in
microsoft.public.sqlserver.xml only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: XML Data Type - Illegal Characters         

Group: microsoft.public.sqlserver.xml · Group Profile
Author: Peter Flynn
Date: Aug 28, 2006 15:12

Amos Soma wrote:
> In my SQL app, I am converting a varchar(max) type, passed to a stored
> procedure, to an XML data type in the stored proc.
>
> I've noticed that if the contents of the varchar(max) string contains
> illegal XML characters (such as '&'), the conversion will fail. This doesn't
> surprise me, and I would expect that. My question is this. Is there any SQL
> function I can call, or some other method, that will convert all illegal XML
> characters to legal equivalents?

There are only two characters which need converting: & must be &
and < must be < (do the first before the second :-)

They're not illegal, just reserved. Real illegal characters are defined
in the XML Spec, and they are mostly control characters which certainly
shouldn't be in any normal text string.

///Peter
no comments
diggit! del.icio.us! reddit!

RELATED THREADS
SubjectArticles qty Group
Re: how to add xml data to listbox based upon selection?microsoft.public.vb.general.discussion ·