Web Dev Matters and Me

Web Development Matters - HTML, XML, C#, .NET, AJAX/Javascript(jQuery), CSS, XML-XSLT

ME - LIFE,Philippines, Tokyo, ECE, PhilNITS/JITSE,情報処理, 日本語

things about Philippines, gaming, C# development and web development, how to make money in stock trading

Web Dev Matters and Me

SQL XML query escapes HTML tags

     just after the big show stopper, I'm now dealing with another one..

Lets say for now, I have something like this

SELECT 'and i'd give up forever to touch ' 'line'
UNION
SELECT 'you cause i know that you feel me so love, your the closest to heaven that i've ever been ' 'line'
UNION
SELECT 'and i don't want to go home right  ' 'line'

UNION
SELECT 'now  and all i can taste is your sweetness ' 'line'
UNION
SELECT 'and all i can breath is your life ' 'line'

FOR XML PATH('test'),TYPE


and, I run it... I'll get those angle brackets escaped (< and >)




fortunately, there is a way to still make those angle brackets, but will lose the XML thing by using value


SELECT 'and i'd give up forever to touch ' 'line'

UNION
SELECT 'you cause i know that you feel me so love, your the closest to heaven that i've ever been ' 'line'
UNION
SELECT 'and i don't want to go home right  ' 'line'

UNION
SELECT 'now  and all i can taste is your sweetness ' 'line'
UNION
SELECT 'and all i can breath is your life ' 'line'

FOR XML PATH('test'),TYPE).value('(/test)[1]','NVARCHAR(MAX)')

will keep the angle brackets, but it is once again, an NVARVCHAR field...

much of an interest, but doesn't help me because I have a large nested XML PATH query.. :(


0 comments:

FB Connect