本文介紹了從數(shù)據(jù)庫(kù)中檢索數(shù)據(jù)時(shí)如何轉(zhuǎn)義特殊字符?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
限時(shí)送ChatGPT賬號(hào)..
我將根據(jù) SQL Server 返回的數(shù)據(jù)生成 XML 文件,但是有一些特殊字符,例如 
和 
(可能還有其他類似的字符),這將使 XML 失敗.
I am going to generate XML file based on the data returned from SQL Server, but there are some special characters like 
and 
(there may be other characters like these), which will fail the XML.
有什么辦法可以擺脫它們嗎?
Is there any way to escape them?
謝謝!
推薦答案
嗯,我只是使用模式匹配的東西來(lái)手動(dòng)替換那些特殊字符.匹配 '&#.+?;'
Well, I just use the pattern matching stuff to replace those special characters manually. Match for '&#.+?;'
這篇關(guān)于從數(shù)據(jù)庫(kù)中檢索數(shù)據(jù)時(shí)如何轉(zhuǎn)義特殊字符?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!