cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gertjan Assies <>
Subject Disappearing namespace definition when xml is generated through a cocoon:// psuedoprotocol
Date Tue, 04 Jan 2005 15:35:17 GMT

I'm having some problems with a disappearing namespace
both seem related to when the xml is generated through a 
cocoon://something in the sitemap
Anyone else have had this problem, and perhaps know how to fix this?

The system that fails:
cocoon- running in Tomcat 4.1

On my laptop I dont have this problem. (winXP, Tomcat 5.0 or 
Jetty/4.2.19, Cocoon, xalan 2.6.0)

Here below are 2 seperate manifestations

1) I have a custom Transformer to create a FreeChart picture, 
(chart-jpeg serializer is JFCSerializer

sitemap snippet :

                        <map:match pattern="**/enquete-report-chart-data/*">
src="cocoon:/{1}/enquete-definition" />
                                <map:transform type="report">
                                        <map:parameter name="question" 
value="{2}" />
                                <map:serialize type="xml" />
                        <map:match pattern="**/enquete-report-chart/*">
src="cocoon:/{1}/enquete-definition" />
                                <map:transform type="report">
                                        <map:parameter name="question" 
value="{2}" />
                                <map:serialize type="chart-jpeg" />

code snippet :

public class ReportTransformer extends AbstractDOMTransformer implements 
Composable {

    protected Document transform(Document doc) {
//the line above returns null for the namespace

        Document newdoc = null;
        Connection connection = null;

        try {
            connection = datasource.getConnection();

            Node qnode = XPathAPI.selectSingleNode(doc, 
"q:enquete/q:questions/q:question[@id = '" + question + "']", doc);
// the line above gives the following error : Prefix must resolve to a 

2) In a custom generator which generates a  cform selection-list xml
the resulting xml lacks the namespace definition.
I could work around this one by explicity adding the namespace attribute 
to the starting element

sitemap snippet :

            <map:match pattern="form/lookup/*">
                <map:generate type="lookup">
                    <map:parameter name="type" value="{1}" />
                <map:serialize type="xml" />

code snippet :

public class LookupGenerator extends AbstractComposableGenerator {

private static final String NAMESPACE_URI_FORMDEFINITION = 

public generate()

        AttributesImpl attributes = new AttributesImpl();
//WORKAROUND: explicitly added namespace attribute
"xmlns:fd", "xmlns:fd", "CDATA", NAMESPACE_URI_FORMDEFINITION);
        // the following adds <fd:selection-list 
"selection-list", "fd:selection-list", attributes);


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message