为您找到"
&
"相关结果约100,000,000个
& is the way to represent an ampersand in most sections of an XML document. If you want to have XML displayed within HTML, you need to first create properly encoded XML (which involves changing & to &) and then use that to create properly encoded HTML (which involves again changing & to &). That results in: &
The ampersand (&) is a special character in XML used to begin entity references. To treat it as data, it must be escaped as "&". This preserves its intended meaning while maintaining XML structure. Correctly escaping ampersands is vital when working with XML documents containing URLs or text with ampersands.
So an actual & got an & escape sequence to render an actual & because early parsers couldn't know if the & was the start of an escape sequence or just a literal &. There are many, many more. So when automated escapers and descapers do their thing with inputs and outputs, they sometimes screw up and will escape **&**amp; as **&**amp ...
Ampersands are escaped like & If I write this HTML as Ampersands are escaped like &
it will be displayed as: Ampersands are escaped like & So I actually need to write:
Ampersands are escaped like &
which displays correctly as: Ampersands are escaped like &
Authors should use & (ASCII decimal 38) instead of "&" to avoid confusion with the beginning of a character reference (entity reference open delimiter). Share. Improve this answer. Follow answered Jun 30, 2011 at 11:47. John Conde ♦ John ...
If you want one to appear in text on a web page you should use the encoded named entity "&"—more technical mumbo-jumbo at w3c.org. While most web browsers will let you get away without encoding them, stuff can get dicey in weird edge cases and fail completely in XML.
decoding: & -> & So what could happen is "Write some text -> HTML encode -> put in database -> HTML encode again-> retrieve and display the text on page" - it could also happen if the text your were trying to put in the database was already HTML encoded to begin with.
& is "valid", though whether you want to use it is another question. If you're writing a document in XML, then & will be used to represent an ampersand. If your XML document is describing content that itself is encoded in a similar way -- e.g. HTML -- then that content could logically include an & itself. This could lead to a & in the XML.
For example, & is escaped with & Should ' be escaped with '?"> That is correct as it can also result in unwanted side effects. e.g.
& ampersand & < less than sign < > greater than sign > " the double quote sign " Appendix II lists a broad range of characters and symbols, relating their ISO names to the corresponding character codes in common character sets. They allow authors to include accented characters in 7-bit ASCII documents.