Entity

  • Example:

    <!DOCTYPE test [
      <!ENTITY whatever "any text, including <elements/>">
      <!ENTITY copy "&#169;">
      <!ENTITY info SYSTEM "http://www.test.com/info.xml">
    ]>
    
    <test>
      &whatever;
      Copyright 2005 &copy; Edwin Dankert
      &info;
    </test>
    					
  • Entity Declarations:

    <!ENTITY whatever "any text, including <element>">
    <!ENTITY copy "&#169;">
    <!ENTITY info SYSTEM "http://www.test.com/info.xml">
  • Entity References:

    &whatever;
    &copy;
    &info;
  • Usage

    You can use entities to substitute often used bits of information, difficult to type characters or even use an entity to include a complete document.

  • Avoid Usage:

    They are a legacy from SGML, they make documents difficult to read, no XML Schema support, not defined as XML Markup itself, don't have to be defined in the XML Document itself. Instead use character-references and XInclude.