简体   繁体   中英

Special Character in XML Attribute Value

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 accomplish 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM