XML – Entities


XML Entities:

  1. All XML documents are comprised of units of storage – entities.
  2. Document entity serves as the starting point for an XML parser.
  3. External and internal subsets of DTD are also entities, but unnamed ones.
  4. Main categories of entities:
    1. Internal vs External
    2. Parsed vs Unparsed
    3. General vs Parameter
  5. Internal entities can only be parsed
  6. External entities can be both parsed/unparsed
  7. General entities can be both parsed/unparsed
  8. Parameter entities are always parsed entities and so can be internal or external
  9. General entities are referenced by using entity reference “&name;” Parameter entities are referenced as “%name;”
  10. Unparsed entities:
    1. May or may not be text
    2. Need not be XML text
    3. Must have associated notation
    4. Can only be used as the value of an attribute having ENTITY/ENTITIES type
  11. The defining declaration should precede any references to the entity
  12. General entities cause fatal XML Parse errors if:
    1. Any reference to an unparsed entity
    2. Any char or general entity reference in DTD except within an entity or attribute value
    3. Any reference to an external entity from within an attribute value
  13. Unparsed entities are always external
  14. Entities can never be empty
  15. An entity reference must not contain the name of an unparsed entity.
  16. Motivation for entities:
    1. To insert special characters
    2. For repeatable text
    3. To include external files, including ones which have non-XML content


Like it? Please Spread the word!

Post Your Thoughts