You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by mi...@sonynetservices.com on 2002/07/25 20:07:14 UTC
XML-Forms and i18n
Hello,
I was just trying to change the XMLFormTransformer to add an
<i18n:text> tag, when the Transformer is dealing with violations.
I tried the following in the startElementViolations method:
1.) I tried to add the tag like this:
// render <violation> tag
super.startElement(uri, TAG_VIOLATION, NS_PREFIX + ":" +
TAG_VIOLATION, attributes );
// set message
String startInter = "<i18n:text>";
String endInter = "</i18n:text>";
String vm = nextViolation.getMessage();
String result = startInter + vm + endInter;
super.characters( result.toCharArray(), 0, result.length());
super.endElement(uri, TAG_VIOLATION, NS_PREFIX + ":" +
TAG_VIOLATION);
2.) and like this:
INTER_PREFIX = "i18n"
TAG_VIOLATION="text"
Here I thought that I could create the i18n tag like the
xf:validation tag is created
// render <violation> tag
super.startElement(uri, TAG_VIOLATION, NS_PREFIX + ":" +
TAG_VIOLATION, attributes );
AttributesImpl emptyAttributes = new AttributesImpl();
super.startElement(null, null, INTER_PREFIX + ":" + TAG_INTER,
emptyAttributes);
String vm = nextViolation.getMessage();
super.characters( vm.toCharArray(), 0, vm.length());
super.endElement(null, null, INTER_PREFIX + ":" + TAG_INTER);
super.endElement(uri, TAG_VIOLATION, NS_PREFIX + ":" +
TAG_VIOLATION);
Both ways did not work. In the first case I got an error message like this:
<i18n:text>error_message</i18n:text>
but it was not translated - so I think that there were no real tags.
The second case was ignored completely - according to the log.
Maybe somebody can advise if I do this at the right place, or if I should
try somewhere else
or how the Transformer works regarding the super.startElement() - if this
is the way how
to add a new element to the xml or if this is done differently?
thanx again for any help,
miHam
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>