This sample application demonstrates the use of catalogs for entity resolution. Note: see the Apache Cocoon documentation Entity resolution with catalogs for the full background and explanation, and the XML source of this document (src/webapp/samples/catalog/catalog-demo.xml).

This top-level XML instance document is catalog-demo.xml - it declares three other XML sub-documents as external entities and then includes them in the sections below. The real system identifiers will be looked up in the catalog, to resolve the actual location of the resource.

The Document Type Definition (DTD) is declared using both a public identifier and a system identifier. The system identifier for the DTD is a network-based resource (which is deliberately non-existent). However, the catalog overrides that remote DTD to instead use a copy from the local filesystem at the location defined by the catalog entry. Note that it is via the use of a public identifier that we gain this power.

The internal DTD subset of the top-level document instance goes on to declare the three external sub-document entities using various means. It also declares and includes the ISOnum set of character entities, so that we can use entities like "½" (to represent ½). Finally the internal DTD subset declares an internal general entity for "&note;".


testpub ... this entity is declared with a PUBLIC identifier and a bogus system identifier (which will be overridden by the catalog)

Note: This paragraph is automatically included from the testpub.txt external file. The entity declaration deliberately used a non-existent file as the system identifier. The catalog then used the declared public identifer to resolve to a specific location on the local filesystem.


testsys ... this entity is declared with a SYSTEM identifier (which will be resolved by the catalog)

Note: This paragraph is automatically included from the testsys.txt external file. The declared SYSTEM identifier was resolved by the catalog to a specific location on the local filesystem.


testovr ... is declared with a PUBLIC identifier and a system identifier (the catalog is set to not override this one, so the declared system identifier is used)

Note: This paragraph is automatically included from the testovr.txt external file. The location of this entity was not resolved by the catalog, because there is no matching catalog entry for its public identifier or its system identifier. So the declared system identifier is used, i.e. the file is retrieved relative to the top-level document.


This footer is applied by the stylesheet. The following entity is resolved by the parser when it interprets the stylesheet
Use ¼ to represent ¼ (one-quarter symbol)
The ISOnum entity set was declared in the header of the stylesheet.