[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: well-formedness error




Danny Ayers wrote:


If I may don the bozo hat for a moment, assume I'm using simple string concatenation to build up the XML document, inserting data from an arbitrary source (say a text field on a HTML form). Now I want to take that hat off. Do you have any (ideally cross-programming language) tips for ensuring the characters conform to the required encoding?

1) Make sure that you indeed know the character encoding for the input. 2) Escape every character outside US-ASCII as character reference. 3) Escape XML-reserved characters (such as "<", ">", "&"...)

Done.

--
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760