xsl-list
[Top] [All Lists]

Re: [xsl] Escaping data in XML attributes

2008-02-09 08:01:39
Robert La Ferla wrote:

Let's say that my database returns this XML unfriendly name that I need to insert into an XML document.

"Bob's Black & Tan "Boston Branch <1>"


Is there a way I can still use attributes yet escape these unsavory characters? What's the most efficient way of solving this?

You need to escape the ampersand as &amp;, the double quote as &quot;, the less-than as &lt; and the greater-than as &gt;. Use an API that does the escaping for you, for instance with the .NET framework there is XmlWriter.



--

        Martin Honnen
        http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>