What serializer are you using? Perhaps the problem is elsewhere. Your first code snippet looks okay to me...

Cheers,
Geert

Marcel Rouwenhorst wrote:
Thanks Geert for answering!

I do use the startPrefixMapping and endPrefixMapping

This are the two source code examples I tried:
1 ----------------------

handler.startPrefixMapping("i18n", I18nTransformer.I18N_NAMESPACE_URI);

AttributesImpl attr = new AttributesImpl();
attr.addCDATAAttribute(I18nTransformer.I18N_NAMESPACE_URI, "key",
"i18n:" + "key", "some_key");

handler.startElement(null, "exception", "exception", null);
handler.startElement(I18nTransformer.I18N_NAMESPACE_URI, "text",
"i18n:text", attr);
handler.endElement(I18nTransformer.I18N_NAMESPACE_URI, "text",
"i18n:text");
handler.endElement(null, "exception", "exception");

handler.endPrefixMapping("i18n");

This example creates the following xml:
<exception>
        <i18n:text i18n:key="some_key"/>
</exception>

2---------------------

If I change the following 2 lines
handler.startPrefixMapping("xmlns", I18nTransformer.I18N_NAMESPACE_URI);

attr.addCDATAAttribute(I18nTransformer.I18N_NAMESPACE_URI, "i18n",
"xmlns:i18n", I18nTransformer.I18N_NAMESPACE_URI);

This example creates the following xml:
<exception>
        <i18n:text xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"/>
</exception>

You can see that there are 2 i18n:text
xmlns:i18n="http://apache.org/cocoon/i18n/2.1"; I get an error "XML Parsing Error: duplicate attribute"

Thank you,
Marcel


-----Oorspronkelijk bericht-----
Van: Geert Josten [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 3 januari 2006 10:08
Aan: [email protected]
Onderwerp: Re: Problem writing generator

Are you using startPrefixMapping and endPrefixMapping to register the
i18n namespace?

Kind regards,
Geert

Marcel Rouwenhorst wrote:


Hi,



I have a problem writing a generator. I want to write a generator for exception handling. It should work something like the exception

generator.

The generator should create an output that looks like this

(simplified):



<exception xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>

<i18n:text i18n:key="some_key">test</i18n:text>

</exception>



I get everything right except I can't create xmlns:i18n="http://apache.org/cocoon/i18n/2.1"; in the exception tag or


any other tag.



I use the org.xml.sax.ContentHandler to create the xml. In the same

way
as the exception generator does.



Help is appreciated



Marcel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]