Hi there, I'm trying to strip out illegal characters for XML attribute values from a string. Any idea where I can get a list of said characters? I've checked the specification but it does not have such a list as far as I can see. Many thanks for your time. Nick.
Nick wrote: > I'm trying to strip out illegal characters for XML attribute values from a > string. Any idea where I can get a list of said characters? I've checked > the specification but it does not have such a list as far as I can see. Characters that are illegal in XML in general do not differ from those that are illegal in attribute values, see http://www.w3.org/TR/xml/#charsets for the allowed characters in XML 1.0. Then there are characters that need to be escaped in character data, the '<' and the '&', and for attribute values additionally depending on the quote character you need to escape the double quote or the single quote character. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
* Nick wrote in microsoft.public.xml: >I'm trying to strip out illegal characters for XML attribute values from a >string. Any idea where I can get a list of said characters? I've checked >the specification but it does not have such a list as far as I can see. It must be one of http://www.w3.org/TR/xml/#NT-Char and you have to escape <, &, and ' or " depending on which you use to delimit the value. -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Hi Martin, Thanks a million for your help that's most appreciated. Nick. "Martin Honnen" wrote in message news:ewSytW61IHA.4668@TK2MSFTNGP02.phx.gbl... > Nick wrote: > >> I'm trying to strip out illegal characters for XML attribute values from >> a string. Any idea where I can get a list of said characters? I've >> checked the specification but it does not have such a list as far as I >> can see. > > Characters that are illegal in XML in general do not differ from those > that are illegal in attribute values, see > http://www.w3.org/TR/xml/#charsets for the allowed characters in XML 1.0. > > Then there are characters that need to be escaped in character data, the > '<' and the '&', and for attribute values additionally depending on the > quote character you need to escape the double quote or the single quote > character. > > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/
Hi Bjoern, Thanks a million for your help also, that's most appreciated, I have all the info I need now, thanks :) Nick. "Bjoern Hoehrmann" wrote in message news:q7f764pqdi0p334ufnqpa5t70ke4qag2j7@hive.bjoern.hoehrmann.de... >* Nick wrote in microsoft.public.xml: >>I'm trying to strip out illegal characters for XML attribute values from a >>string. Any idea where I can get a list of said characters? I've checked >>the specification but it does not have such a list as far as I can see. > > It must be one of http://www.w3.org/TR/xml/#NT-Char and you have to > escape <, &, and ' or " depending on which you use to delimit the value. > -- > Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de > Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de > 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/