Entities in XML

The purpose of this assignment was to:

The description and my solution of the Entities in XML - assignment can be viewed at the bottom of this page.

What are Entities in XML?

Entities are variables for defining shortcuts/macros to text.
An entity reference refers to an entity.

They can be declared as:

Internal Entity Declaration

This is the syntax for an internal declaration:

<!ENTITY entity-name "entity-value">

DTD Example:

<!ENTITY rights "Copyright Information.">

XML example:

<rights>&rights;</rights>

External Entity Declaration

This is the syntax for an external declaration:

<!ENTITY entity-name SYSTEM "URI/URL">

DTD Example:

<!ENTITY education SYSTEM "http://www.webpelican.com/internet-programming-4/entities-in-xml/education.xml">

XML example:

<cv-template> child elements ... . . . &education; . . . </cv-template>

Assignment Description

Extend the cv-template from Namespaces in XML assignment to use internal and external entiteter. External entities should be demonstrated by deviding the XML document into at least two chunks and include them with entity references.

Make sure the document is well-formed.

My solution, Assignment Files

I've put the text content of the rights element as an internal entity and included it with an entity reference.
Also, I've cut out the education element and put it in it's own .xml file and included it with an entity reference as an external entity.

Note: Since Firefox has a bug for externa entiteter - Bugzilla Bug 69799: External entities are not included in XML documents - a different browser must be used to see the included external entities.

«  Previous Next  »
Loading