XML Entity

We are familiar to HTML Entities. HTML Entity is symbolic representation of the information.

Lest take look at some HTML Entity –

  • © = ©
  • &lt; = <
  • &amp; = &
  • &quot; = “

XML also supports the entity , An entity in XML is represented using an ampersand (&), followed by the name of the symbol, and ends with a semicolon.

Example:

Creating an XML Entity

We can create our own custom entity, by defining it in DTD. Once we defined it we can use it in our XML document.

Syntax:

Here is syntax to define entity in DTD

Using Your Custom Entity

Once we have created XML entity we can use it in following way, let take look in below example code