Given the following XML file, what do the DOCTYPE, ENTITY, SYSTEM, &entity (reference?) represent?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY entity SYSTEM "./entity.xml">
]>
<root>
<element attribute="value">
&entity;
<child>
<!-- some more nested -->
</child>
</element>
</root>
The DOCTYPE declaration is specifying the root element (
root).The entity declaration (
ENTITY) is pointing to the fileentity.xmlon the system (SYSTEM).The entity reference (
&entity;) references the entity declaration namedentity. The easiest way to think of it is that&entity;is replaced with everything that is inentity.xml.Here’s a good link that covers entities (including parameter entities): http://www.w3.org/TR/2004/REC-xml-20040204/#sec-entity-decl