开发者

Special Character in XML Attribute Value

开发者 https://www.devze.com 2022-12-16 05:45 出处:网络
I want to put a colon in an attribute value that is used to display the title of a chart on my webpage.

I want to put a colon in an attribute value that is used to display the title of a chart on my webpage.

I have something like:

<chart displayname="This is the chart name"  resource = "blah blah blah">

I want the display name to be something like "This: is the chart name"

How can I accomp开发者_如何学运维lish this?

If it helps here are the HTML codes of the characters I want to use: &#45; and &#58;


Colon is not a special character. Just put it in there, it will work.


If you want to keep your attributes alphanumeric, use the UTF notation instead of the colon:

  displayname="This&#58;My Chart"

Obviously the semicolon and spaces are not alphanumeric, but the above will achieve what I think you are going for.

0

精彩评论

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