You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by George Singer <gs...@lincoln.ac.uk> on 2004/08/02 08:20:58 UTC

Problem using Entities to display Raw XML inside Cocoon

Given:

(1) xml INPUT people.xml :

<?xml version="1.0"?>

<!DOCTYPE people SYSTEM "ENTITIES/person.dtd" [

<!ELEMENT people (person+)>

<!ENTITY neil SYSTEM "ENTITIES/neil.xml">

<!ENTITY richie SYSTEM "ENTITIES/richie.ent">

]>

<people>

<person>

<name>

<firstname>Jeremy</firstname>

<surname>Aston</surname>

</name>

<profession>Software Developer</profession>

</person>

&neil;

&richie;

</people>

 

(2) OUTPUT FROM EXPLORER (collapsable + / - signs omitted for clarity):

 

<?xml version="1.0"?> 

<!DOCTYPE people (View Source for full doctype...)> 

<people>

<person>

<name>

<firstname>Jeremy</firstname> 

<surname>Aston</surname> 

</name>

<profession>Software Developer</profession> 

</person>

<person>

<name>

<firstname>Neil</firstname> 

<surname>Hodgson</surname> 

</name>

<profession>Motorcycle Racer</profession> 

</person>

<person>

<name>

<firstname>Ritchie</firstname> 

<surname>Hawtin</surname> 

</name>

<profession>Music Producer</profession> 

</person>

</people>

 

(3) OUTPUT from Explorer in Cocoon:

 

<?xml version="1.0" encoding="ISO-8859-1"?> 

<!DOCTYPE people (View Source for full doctype...)> 

<people>

<person>

<name>

<firstname>Jeremy</firstname> 

<surname>Aston</surname> 

</name>

<profession>Software Developer</profession> 

</person>

Neil Hodgson Motorcycle Racer Ritchie Hawtin Music Producer Project Manager 

</people>

 

As you can see, only the content of the entity elements is displayed. 

If I attach an XSL stylesheet it works fine (pattern="people" below).

I've tried readers etc in the sitemap below, with no success.

Can anyone explain how I get the output given in (2) inside Cocoon?

regards

georges

 

 

(4) SITEMAP:

 

<?xml version="1.0"?>

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

<map:pipelines>

<map:pipeline>

<map:match pattern="people">

<map:generate src="people.xml"/>

<map:transform src="people2html.xsl"/>

<map:serialize type="html"/>

</map:match>

<map:match pattern="people.xml">

<map:generate src="people.xml"/>

<map:serialize type="xml"/>

</map:match>

<map:match pattern="**.dtd">

<map:read src="{1}.dtd" mime-type="text/text"/>

</map:match>

<!-- MIME for ENT text/xml / plain / text ??-->

<map:match pattern="**.ent">

<map:read src="{1}.ent" mime-type="text/xml"/>

</map:match>

<map:match pattern="**.xml">

<map:read src="{1}.xml" mime-type="text/xml"/>

</map:match>

</map:pipeline>

</map:pipelines>

</map:sitemap>

 

(5) person.dtd:

<!ELEMENT person (name, profession?)>

<!ELEMENT name (firstname, surname)>

<!ELEMENT firstname (#PCDATA)>

<!ELEMENT surname (#PCDATA)>

<!ELEMENT profession (#PCDATA)>

(6) neil.xml

<person>

<name>

<firstname>Neil</firstname> 

<surname>Hodgson</surname> 

</name>

<profession>Motorcycle Racer</profession> 

</person>

 

(7) richie.ent

<person>

<name>

<firstname>Ritchie</firstname> 

<surname>Hawtin</surname> 

</name>

<profession>Music Producer</profession> 

</person>