Home > Articles > Web Services > XML

  • Print
  • + Share This

Understanding Literals

Literal data is any quoted string not containing the quotation mark used as a delimiter for that string. The quotation mark can be either a single quote or a double quote at the convenience of the coder. If you want to make a literal of a string containing both single and double quotes, you can escape whichever one you use to quote the string. Literals are used for specifying the content of internal entities, the values of attributes, and external identifiers. The following are some examples of literal data:

  • Literal data: "The quick brown fox jumps over the lazy dogs."

  • Alternate form: 'The lazy hen clucked "merrily" over her jumbled nest.'

  • Escaped form: 'Now is the time for George's "good guy" quote:'

The first example uses simple quotes, as they would be entered in the U.S. The second uses initial single quotes as they do in the U.K. and many other parts of the English-speaking world. The third example contains both single and double quotes, so the single quote used as an apostrophe is escaped using a character entity.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.