开发者

Escape <?xml version="1.0" ?> tag from HTML

开发者 https://www.devze.com 2023-02-02 20:16 出处:网络
I am trying to embedded a XML inside开发者_JAVA技巧 a HTML page with hidden div and using it latter to populate UI fields.

I am trying to embedded a XML inside开发者_JAVA技巧 a HTML page with hidden div and using it latter to populate UI fields.

The problem is, I can't parse it since tag is missing.

How can I escape the entire tag?


Why not add that tag and then parse it?


I would be better to put the content inside a hidden textarea, to keep your HTML markup correct.

Either way, you should be able to escape it by changing < to &lt; and > to &gt;.

(This should be done to the all of the XML tags, not only the <?xml ?> tag.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号