Re: Documentation for the available JavaScript functions, especially Flows and Forms

2006-09-14 Thread Bruno Dumon
On Wed, 2006-09-13 at 23:05 +0200, Dev at weitling wrote:
> Hi!
> 
> Is there a documentation available about the javascript routines used in 
> Flows and Forms? The hint looking at the JavaScript sources is imho not 
> really helpful, because they are rather complex.

The javascript layer is very thin, it's just one file, and the most
important functions are all documented:
http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/flow/javascript/Form.js?revision=414691&view=markup

If you do form.getWidget() on the javascript form object, you get the
Java form object, for which you can browse the javadocs:
http://cocoon.apache.org/2.1/apidocs/index.html

(see package org.apache.cocoon.forms and subpackages).

Some introductary material on this would be helpful indeed, but the
above together with the samples should get you started.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Documentation about all available XML tags and their usage

2006-09-14 Thread Bruno Dumon
On Wed, 2006-09-13 at 22:59 +0200, Florian Weitling wrote:
> Hi!
> 
> The documentation of Cocoon is overwhelming but after digging nearly two 
> months in it I still desire a complete list of all available XML tags 
> and their usage for the sitemap, xsp, jx, cforms and and and.
> Some DTDs could help for the beginning, too.
> 

A reference of the sitemap elements can be found here:
http://cocoon.zones.apache.org/daisy/documentation/863/sitemap/reference/pipeline_elements/842.html

For JX, it can be found here:
http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html

The CForms documentation should be pretty complete too.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: [CForms] Howto?: bind repeater to collection of String

2006-07-18 Thread Bruno Dumon
On Mon, 2006-07-17 at 18:04 -0700, Mark Lundquist wrote:
> 
> 
> __
> 
> 
> OK, I've spent way too long trying to figure this out... :-/
> 
> I always get annoyed with having to play games in flowscript in order
> to use a selection list or a  to manipulate
> collections of beans.  Those widgets work great for value types like
> String, not for  entities.  But that's another story...  Today, I am
> trying to bind a repeater to a collection of String!  And it's not
> working.  Looking at the source code, I guess how I'm doing it isn't
> advertised to work in the first place... OK, fine, I just need to
> learn the correct way to accomplish it! :-)
> 
> So the deal is, the user gets to create new items or delete existing
> ones.  (They don't get to change any existing items... just delete
> 'em.  Hence the ).
> 
> Here's my definition:
> 
> 
>   Available Editions
>   
> 
>   
>   Name
> 
> 
>   delete
> 
>   
> 
> 
> 
>   Add new
> 
> 
> 
>   
>   
> 
>   New edition must have a
> name
> 
>   
> 
> 
> And here's my binding:
> 
>id="editions"
> parent-path="."
> row-path="editions" 
>   >   
>   
>  
>   
>   
> 
> The "Add new" button works by triggering this bit of flowscript:
> 
> form.lookupWidget ('editions')
> .addRow()
> .getChild('name').value =
> form.lookupWidget ('new-edition-name').value;
> 
> ...and the "delete" row-action just works... sorta (see below).
> 
> The "load" side works fine and the list displays correctly.  The
> delete row-action appears to work fine (w.r.t. refreshing the page),
> and so does the scheme using the two widgets to add a new item.  The
> problem is that when I do a save, the back end model isn't modified
> — the new items aren't added, and the deleted items aren't removed.
> So, two questions:
> 
> 1) What is the deal with row deletion?  Apparently when binding to an
> XML tree, you have to say
> 
> 
> 
> 
> 
> if you want the delete row-action to do anything.  Why?  And don't you
> have to do anything special in the binding to make delete work when
> you are binding to a Collection?  If so, what?
> 
> 2) What's the deal with row insertion?  I get this warning in the log
> 
> RepeaterJXPathBinding: RepeaterBinding has detected rows to insert,
> but misses the  binding to do it.
> 
> OK, I get it... for a bean, we need to register a factory so that the
> binding will know how to create the new thing.  Fair enough.  But I've
> been looking at the documentation
> (http://cocoon.apache.org/2.1/userdocs/binding.html), and I don't get
> it... how about an example?  And anyway, I don't have a bean here.
> Just a String.  How do I make this work?

I don't know much about repeater binding and didn't read your problem in
detail, but if you're just binding to a collection of strings you could
as well use the fb:simple-repeater binding (not sure if this works for
beans though).

For the normal binding, note that your string values need to be unique
for it to work (since you're using the string as identity).

For the insert-bean, I guess this won't work for strings as they're
immutable.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: basic cforms validation problem or bug?

2006-06-18 Thread Bruno Dumon
On Wed, 2006-06-14 at 16:16 +0200, es wrote:
> I have 3 very basic cforms validation scenario 3 different problems with 
> them.
> 
> 1) I have a combo-box with with 1 2 3 as values, on-value-changed I 
> whant widget "Nliv1" "Nliv2" "Nliv3" to be WidgetState.ACTIVE and their 
> values to be back to 0 so I wrote:
> if (newValue == 1) {
>var nliv2 = widget.lookupWidget("../Nliv2");
>nliv2.setState(WidgetState.INVISIBLE);
>nliv2.value = 0;
> I tried also with
>nliv2.value = parseInt("0");
> but I got java.lang.RuntimeException: Incorrect value type for "Nliv2" 
> (expected class java.lang.Integer, got class java.lang.Double).
> but 0 is 0 not 0.0d.
> weird.

As the error message says, the value of the widget should be set to
something of type java.lang.Integer, so do:

nliv2.value = new java.lang.Integer(0);

> 2) This is probably a bug... in the same form "Nliv1" "Nliv2" "Nliv3" 
> sum must be equal to a value of another widget so I check for the same 
> assert condition and I need to display the same failmessage however only 
>   when "Nliv1" is ACTIVE I can see the failmessage in the other widget I 
> got "Error evaluating expression on assert validation rule"
> 3) In an another form a field called "ag" datatype "float" with   
>  
>  and I got java.lang.ClassCastException: 
> java.math.BigDecimal.

It seems like the field value is not being converted to a BigDecimal
when it is passed into the expression engine. I guess you're not yet
using Cocoon 2.1.9?

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CForms: leading spaces dissapearing

2006-06-08 Thread Bruno Dumon
On Thu, 2006-06-08 at 08:01 -0600, Jason Johnston wrote:
> Antonio Gallardo wrote:
> > [EMAIL PROTECTED] escribió:
> >> OK. I think I found it in Field.java, where it does
> >>
> >> newEnteredValue = newEnteredValue.trim();
> >>   
> > Hi Fernando,
> > 
> > Great you found it! You should can create a patch to optionally 
> > configure leading spaces and keeping the former behavior as the default 
> > behavior. WDYT?
> 
> FWIW I think this might best be implemented in the Convertor layer, that 
> seems most appropriate for converting untrimmed strings to trimmed and 
> vice versa.  A PlainStringConvertor for instance would keep 
> leading/trailing whitespace intact.  WDYT?
> 
> If Fernando doesn't want to create a patch I will do so since this has 
> annoyed me in the past as well.

Cool!

If you do it on the convertor layer, it would mean that every convertor
needs to handle whitespace for itself. For example, a date field
containing just a space would currently be treated as an empty input,
while otherwise it would be up to the date convertor to detect this.
This probably isn't a huge problem, a simple trim() and empty string
check at the start of the existing convertors could solve this.

If you go for the convertor approach, I would suggest to make the
default string convertor configurable, instead of creating multiple
convertors.

For example, using a whitespace attribute that could have the following
values:

whitespace="preserve|trim|trim-left|trim-right"

and possibly a trim-if-all-whitespace attribute to force trimming in
case the input contains only whitespace.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CForms: leading spaces dissapearing

2006-06-07 Thread Bruno Dumon
On Tue, 2006-06-06 at 15:57 +0200, [EMAIL PROTECTED] wrote:
> I have a text field in a CForm, and when it is submitted, the leading
> spaces
> 
> in the text dissapear.
> 
>  
> 
> I am using Cocoon 2.1.8
> 
> Is there any way to disable this behavior?
> 

nope, this behaviour is currently hardcoded in the field widget. It is a
todo item to make this configurable.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: cocoon actions implements threadsafe

2006-06-03 Thread Bruno Dumon
On Fri, 2006-06-02 at 14:11 -0400, Doug Herold wrote:
> I am sorry I meant SingleThreaded.  So you would think that this is a
> bottle neck.

Unless your actions require heavy initialisation, implementing
ThreadSafe or not will only result in minor performance differences (if
you call multiple actions during the processing of a request, at best
you'll see a difference of a few msecs -- its the difference between
directly using an object or having to look it up from the component
manager).

So sure, implement ThreadSafe if possible, but if you have serious
performance issues with your application they are likely to be somewhere
else...

> 
> Doug Herold wrote:
> 
> > Hi,
> >
> > I have noticed that some of our programers are using
> threadsafe when
> > creating a class for actions.
> >
> > public *class* StudentSearchAction *extends* AbstractAction
> * 
> > implements* SingleThreaded {
> >
> > I read that you should never use SingleThreaded and that it
> was going
> > to be depreciated.  Our server has a very large load, but we
> were
> > having problems with one user being able to see another
> users info.  I 
> > think this is why the used this.  We are now having problems
> with
> > performance.  Could this cause performance issues.
> >
> > Could someone point me to any good articles about the
> dangers
> > of SingleThread classes and what to do instead of using
> them. 
> >
> > Thanks in advance
> > Doug

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: [2.1.9] validation transformer documentation

2006-06-01 Thread Bruno Dumon
On Thu, 2006-06-01 at 19:22 +0200, Reinhard Haller wrote:
> Hi,
> 
> all links to the documentation (from the validation blocks sample)
> on cocoon.zones.apache.org are broken.
> 
> Is there a newer/changed documentation than the wiki one?

see

http://cocoon.zones.apache.org/daisy/documentation/683.html
http://cocoon.zones.apache.org/daisy/documentation/684.html
http://cocoon.zones.apache.org/daisy/documentation/691.html

I'll see to fix the links.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: NPE when styling a textarea

2006-05-18 Thread Bruno Dumon
On Wed, 2006-05-17 at 10:26 -0400, Kaj Kandler wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hi there,
> I'm using 2.1.8 and have trouble styling a form field as textarea.
> 
>  
>   
>  
> 
> I'm getting a null pointer exception. Any ideas why? Does someone know a
> solution?

I'm not sure if this can be the cause of the problem, but you don't
happen to be using both the forms transformer and the forms jx-macros at
the same time?

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: [CFORMS] Italian decimal in fd:convertor

2006-05-04 Thread Bruno Dumon
On Thu, 2006-05-04 at 16:12 +0200, Alessandro Vincelli wrote:
> Thanks, but I have already tried with this solution
> #,00
> but don't work.
> 
> :(
> 
> Cocoon output:
> 
> 1,000.90
> 
> but I want:
> 
> 1.000,90

Did you actually change the locale to be used when processing and
rendering the form to it_IT?

See towards the end of this page:
http://cocoon.zones.apache.org/daisy/documentation/864/forms/basics/752.html

You need to set a locale property on the form object in flow, and also
pass a locale parameter to the form template in the sitemap (supposing
you're not using the forms-transformer).

At least that's how it worked in 2.1.8, I haven't checked yet if this
changed in 2.1.9.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: JX generator migration

2006-04-25 Thread Bruno Dumon
On Mon, 2006-04-24 at 19:46 +0200, werner wrote:
> Dear Mailinglist!
> 
> I'm migrating an application from the "old" JX-Template generator to the 
> new one. Some of my  templates don't work anymore.  Is there some kind 
> of documentation (except source code ;-) ) out there that describes the 
> differences? I'm asking this because I used Jexl in my templates and 
> there seem to be some changes.

AFAIK there shouldn't be any differences, though accessing objects like
request directly is not supported anymore, instead you need to use
cocoon.request

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CFORMS: datatype - formatting (decimal)

2006-04-10 Thread Bruno Dumon
On Sat, 2006-04-08 at 10:02 +0100, Peter Sparkes wrote:
> HI,
> 
> I am using CForms to amend xml documents. I have several field widgets 
> with datatype 'integer'. The default formatting for integer is of the 
> form '1,234,567,890'. I need to change the formatting to '1234567890'.
> 
> In my binding file I am using for example
> 
>   
>   
>   
>   
>   
> 
> On loading a document with attribute no="1234567890" I still get 
> '1,234,567,890' in the Form, however, when saving the amended form it 
> works correctly and I get no="1234567890" in the xml doc. If I change 
> the ### to for example ##,##,##,##,## the form still gives 
> '1,234,567,890', however, the saved xml correctly  reflects  the new 
> pattern eg 12,34,56,78,90
> 
> Please, how do I get the format '1234567890' in the CForm

The convertor in the binding is only relevant to the binding, you need
to specify it in the form definition too.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: "auth-protect" not defined for "act"

2006-04-06 Thread Bruno Dumon
On Wed, 2006-04-05 at 22:05 +0100, Peter Flynn wrote:
> Andrew Stevens wrote:
> >> From: Peter Flynn <[EMAIL PROTECTED]>
> >> Date: Tue, 04 Apr 2006 20:03:56 +0100
> >>
> >> I added
> >>
> >>>>   src="org.apache.cocoon.webapps.authentication.acting.LoginAction"/>
> >>
> >> to the  section of my sitemap
> > 
> > Inside the , right?
> 
> Yes. But -- g -- I has pasted it inside the LocaleAction
> definition, which in the sample sitemap is the only non-empty
> element there. Must have been late at night.
> 
> So now that works, many thanks, but I now get the same class of
> error saying that auth-protect isn't defined. So taking a guess
> I tried
> 
>   src="org.apache.cocoon.webapps.authentication.acting.ProtectAction"/>
> 
> not expecting it to work, and I wasn't disappointed :-) How many more
> of these are there, and where are they documented? There's no mention
> of them in the pages about Authentication.

Just guessing class names isn't very effective indeed ;-)

One way to know what exists is of course to check the source code.

Another way is to go to here:
http://cocoon.zones.apache.org/daisy/documentation/facetedBrowser/default

and choose "authentication-fw" for CocoonBlock and "Action" for
CocoonComponentReference, and this should show you a list of all actions
in the authentication framework.

(note: not all blocks are in there yet, but the authentication-fw is)

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: binding framework and multivaluefields

2006-03-29 Thread Bruno Dumon
In addition to this, since your multivaluefield uses "long" as datatype,
you should use java.lang.Long, not java.lang.Integer.

On Tue, 2006-03-28 at 22:18 +0200, Simone Gianni wrote:
> Hi Brian,
> i think java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 0); 
> generates an array of int ( 
> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html#TYPE ), 
> while the multivalued field probably needs an array of Integer, since 
> internally it gets converted to an Object[] array. Maybe with java 1.5 
> this would be managed by automatic boxing, but i would recommend to use 
> an array of Integer.
> 
> This means writing something like var values = 
> java.lang.reflect.Array.newInstance(java.lang.Integer.class, 0); (not 
> sure this works perfectly in javascript, otherwise use 
> Class.forName('java.lang.Integer') instead of java.lang.Integer.class).
> 
> Hope this helps,
> Simone
> 
> Brian Maddy wrote:
> 
> > Does anyone know how to use the binding framework to set a 
> > multivaluefield?  My XML file has a string that is comma separated 
> > values that I need to load in, but I can't even get a simple array to 
> > work.  Here's what I have so far:
> >
> > Form Definition:
> >
> >
> >
> >Unit Type(s):
> >
> >
> >value 1
> >
> >
> >value 2
> >
> >
> >value 3
> >
> >
> >
> >
> > Form Binding:
> > > direction="load">
> >
> > var values = 
> > java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 0);
> > //values[0] = 1;
> > //values[1] = 2;
> > //values[2] = 3;
> > widget.setValue(values);
> >
> >
> >
> > If I set the values variable to null, the form displays correctly, so 
> > everything else seems to be working.
> >
> > Anyone know how to do this?
> >
> > Thanks!
> > Brian

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: JXel Issues, Won't recognize params from sitemap

2006-03-24 Thread Bruno Dumon
On Thu, 2006-03-23 at 23:33 -0500, Berin Loritsch wrote:

> It turns out that you can't use Java Objects other than string if you 
> are passing from the sitemap.

Yes indeed.

>   I consider this to be a bug.  

You can consider it to be whatever you want ;-) I guess for a large part
it is because of historical reasons (from times before the input modules
existed).

This doesn't mean it can't evolve, if you have enough itch, be sure to
take this up on the dev list.

> Particularly since you can't pass in anything through 
> cocoon.request.getAttribute() unless you go through a flowscript?!?

Not sure what you mean here, the sitemap indeed has only a limitted
number of constructs, and provides no built-in way to do that (there
might be some input-/output-module based action which does this, I'd
need to check up on that).

In a lot of cases, when you start doing things with objects one probably
needs to express more programmatic things anyway, so that going through
some flow code is beneficial.

>   I 
> eventually had to bounce the request through a flowscript just to get 
> the value passed.  It's a pain in the arse.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: JXel Issues, Won't recognize params from sitemap

2006-03-23 Thread Bruno Dumon
On Thu, 2006-03-23 at 15:27 -0500, Berin Loritsch wrote:
> I need to pass parameters into my Jexl.  As long as the call to the 
> resource originally comes from the flowscript, everything seems to be 
> OK.  HOwever, I can't seem to pass parameters directly from the sitemap.
> 
> Anyone know what's going on?

There are indeed some differences between calling JXTemplate from flow
or directly, though I don't recall what these were exactly (would need
to check the sources). Some things you might try until someone more
experienced helps you:

* instead of "cocoon.parameters", use just "parameters"
* try JXPath instead of Jexl: #{$cocoon/parameters/something}
* or if you're on Cocoon 2_1_x head, use the template block instead
(just switch the jx declaration to o.a.c.template.JXTemplateGenerator)
which should solve these differences

Not sure if any of these will help.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Validation problem by using widget field with datatype base="date"

2006-03-23 Thread Bruno Dumon
On Thu, 2006-03-23 at 18:59 +0100, Alexander Lurk wrote:
> Hi
> 
> I have a validation problem by using a widget field with datatype base="date".
> The sitemap and model looks like the following:
> 
> Sitemap:
> - snip -
> ...
> 
>   
> 
> 
>   
> 
> 
>   
> 
> 
> 
>   
> 
> ...
> - snip -
> 
> Model:
> - snip -
> ...
> 
>   
>   
> 
> ...
> - snip -
> 
> If I choose after running with the help of the calendar a date (day)
> it will be taken over in the input field in the following format:
> 3/23/06
> That's correct.
> But if I press now the submit button the validation of the date failed
> with the message "Not a valid date"!!!
> 
> If I change the language in the sitemap to German (de-DE) I get the
> date 23.03.06 and no validation problem. In this case if works fine.
> 
> What's wrong?

You might be missing the locale setting on the form object in the
flowscript:

form.locale = new java.util.Locale("en-EN")

The locale settings you did in the pipeline influence the rendering of
the form, the locale setting on the form object influences the reading
and processing of the form data from the http request. These two locales
(rendering & processing) should always match. Currently it is up to you
to make sure this is the case, maybe in the future Cocoon will have a
more generalized locale setting.

See also "using i18n" on
http://cocoon.apache.org/2.1/userdocs/basics/improving_sample.html

> 
> Is it possible to solve the problem by using the i18n transformer
> ()?
> If yes how?
> 
> Remark: I'm using Cocoon 2.1.8 and the german version of Mozilla
> Firefox 1.5.0.1.

The language version of the browser shouldn't matter in this.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Where are the JavaScript functions?

2006-03-23 Thread Bruno Dumon
On Wed, 2006-03-22 at 10:45 -0300, Nicolás Lichtmaier wrote:
> > In your sitemap.xmap, you need to include a matcher for the 
> > client-side javascript files. You should write something like this:
> >
> > 
> >  
> > 
> 
> I already have that in the sitemap. But there's no inclussion, no 
> 

Re: Where are the JavaScript functions?

2006-03-23 Thread Bruno Dumon
On Wed, 2006-03-22 at 10:45 -0300, Nicolás Lichtmaier wrote:
> > In your sitemap.xmap, you need to include a matcher for the 
> > client-side javascript files. You should write something like this:
> >
> > 
> >  
> > 
> 
> I already have that in the sitemap. But there's no inclussion, no 
> 

Re: HttpServletRequest?

2006-03-22 Thread Bruno Dumon
Hi,

If you search the archives of the dev list, you should find recent
(dec-feb) discussions on this topic, look for threads with titles like

Ditching the environment abstraction
The environment abstraction, part II
Let the environment interfaces extend the javax.servlet.http ones

On Wed, 2006-03-22 at 09:27 -0700, Brian Hawkins wrote:
> In thinking about this more I think the best solution all around is to 
> have the cocoon Request interface inherit from the HttpServletRequest 
> interface.  Then it could be passed around and used in any servlet.
> 
> Brian
> 
> Brian Hawkins wrote:
> > This brings up a good question.  Why does cocoon feel the need to wrap 
> > every object?  The cocoon Request interface is (as far as I can tell) 
> > identical to the HttpServletRequest interface.  From the code the only 
> > difference is that is wraps other objects like the session.  All this 
> > seems to do is frustrate developers who have to inter operate with 
> > other servlets running in the same container.
> >
> > Fernando,  I think the solution for both of us is to hack the 
> > HttpRequest object and provide a getHttpServletReuqest method.
> >
> > Brian
> >
> > [EMAIL PROTECTED] wrote:
> >>
> >> In a component, I need to call a third-party method which takes a 
> >> HttpServletRequest as a parameter.
> >>
> >> In this component, I have access to a cocoon Request.
> >>
> >> How can I do to get to an HttpServletRequest? The method I want to 
> >> call needs to look at the headers and source IP address.
> >>
> >>  
> >>
> >> Thanks
> >>
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: HttpServletRequest?

2006-03-22 Thread Bruno Dumon
On Wed, 2006-03-22 at 16:43 +0100, [EMAIL PROTECTED] wrote:
> In a component, I need to call a third-party method which takes a
> HttpServletRequest as a parameter.
> 
> In this component, I have access to a cocoon Request.
> 
> How can I do to get to an HttpServletRequest? The method I want to
> call needs to look at the headers and source IP address.

The original request object is stored in the objectModel, you can access
it like this:

HttpServletRequest httpRequest = (HttpServletRequest) 
objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Mixing flow resources

2006-03-20 Thread Bruno Dumon
On Mon, 2006-03-20 at 13:11 +, Andrew Madu wrote:
> Hi Bruno,
> any ideas if and when this feature will be implemented into cocoon>
> 

There are no plans to do so, if you think this should be changed, you
can start a discussion on the mailing list.


> Andrew
> 
> On 3/20/06, Bruno Dumon <[EMAIL PROTECTED]> wrote:
> On Sun, 2006-03-19 at 15:30 -0800, Andrew Madu wrote:
> > Hi,
> > can anyone tell me whether it is possible to mix both
> JavaFlow and
> > flowscript resources in a sitemap? For example when I do:
> >
> >
> >  
> >   
> >
> >  
> >  
> >   
> >
> > I get an error message informing me that the class file
> Login does not
> > exist. How can I manage both in the same sitemap?
> 
> It is not possible. IIRC, not so much because of technical
> reasons, but 
> because at the time it was felt that the Cocoon community
> should focus
> on just one flow implementation (javascript).
> 
> --
> Bruno Dumon
> http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support
> Center
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> 
> 
> -----
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Mixing flow resources

2006-03-20 Thread Bruno Dumon
On Sun, 2006-03-19 at 15:30 -0800, Andrew Madu wrote:
> Hi,
> can anyone tell me whether it is possible to mix both JavaFlow and
> flowscript resources in a sitemap? For example when I do:
> 
>   
>  
>   
>   
>  
>  
>  
> 
> I get an error message informing me that the class file Login does not
> exist. How can I manage both in the same sitemap?

It is not possible. IIRC, not so much because of technical reasons, but
because at the time it was felt that the Cocoon community should focus
on just one flow implementation (javascript).

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: is it possible to cache sql queries?

2006-03-20 Thread Bruno Dumon
On Sun, 2006-03-19 at 22:38 +0100, Ard Schrijvers wrote:
> > Hi Ard,
> > 
> > in yours & Max'es mails there's quite some useful information on the
> > ExpiresCachingProcessingPipeline. How about writing some documentation
> > on it over at
> > 
> > http://cocoon.zones.apache.org/daisy/documentation/components/
> > 1063/g1/939.html
> > 
> > Just a gentle suggestion. If you register in Daisy and let us 
> > know your
> > login, we can give you edit access.
> 
> This sounds like a good idea to me...I will make some time coming days
> and let you know the login to get edit access, allright?

great!

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: is it possible to cache sql queries?

2006-03-19 Thread Bruno Dumon
Hi Ard,

in yours & Max'es mails there's quite some useful information on the
ExpiresCachingProcessingPipeline. How about writing some documentation
on it over at

http://cocoon.zones.apache.org/daisy/documentation/components/1063/g1/939.html

Just a gentle suggestion. If you register in Daisy and let us know your
login, we can give you edit access.

On Thu, 2006-03-16 at 17:48 +0100, Ard Schrijvers wrote:
> For those wanting to use the ExpiresCachingProcessingPipeline in example a 
> poll or forum you are able to do this as follows:
> 
> add the parameters :
> 
>  
> 
> 
> 
> Now your poll/forum is very long cached (10 sec). When somebody votes/a 
> new reaction is added, make sure that action is done with an extra parameter: 
> purge-cache=true.
> 
> This way, after a vote, the specific pipeline's cached is purged, and rebuild 
> and again cached for very long (10 sec). This way you can deliver high 
> performance polls/fora. This is already available in 
> ExpiresCachingProcessingPipeline in 2.1.8
> 
> AS
> 
> ps what I still want to build is that you can define a time untill which the 
> ExpiresCachingProcessingPipeline is valid, instead of giving it just an 
> "arbitrary" value. Often I know that a pipeline is valid untill 0:00, BUT, 
> since I dont know when the first request comes, I can not cache it longer 
> then, say 5 minutes (so that it is cached maximally untill 0:04:59). More 
> people interesting in this feature? 
> 
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: is it possible to cache sql queries?

2006-03-15 Thread Bruno Dumon
On Wed, 2006-03-15 at 12:15 +0100, Ard Schrijvers wrote:
> > On Tue, 2006-03-14 at 23:04 +0100, Ard Schrijvers wrote:
> > > > Yeah, good call.  I was actually thinking of something that could 
> > > > override the caching on an entire pipeline.  Then it could be 
> > > > used for 
> > > > other things like grabbing rss feeds or something.  For example:
> > > > 
> > > > 
> > > >   
> > > >   ...
> > > > 
> > > > 
> > > 
> > > Don't build it yourself!! There is just a pipeline exactly 
> > doing what you want: Use the exiring pipeline:
> > > 
> > >  > src="org.apache.cocoon.components.pipeline.impl.ExpiresCaching
> > ProcessingPipeline">
> > >  
> > > 
> > > 
> > > Now use :
> > > 
> > >  
> > >   
> > >> >   your matchers here...
> > > 
> > > That is all: 
> > > 
> > > In the cache-key you can also take request-params like:  
> >  > value="{0}-{request-param:page}" /> 
> > > 
> > > There is certainly no need to write your own caching mechanism for
> > > this...if this cached result is not returned fast enough 
> > from cocoon,
> > > since cache-key lookups and validity checks are still done we have a
> > > (probably not yet committed to cocoon) version of the
> > > ExpiresCachingProcessingPipeline performing MUCH faster for complex
> > > pipelines. 
> > 
> > This is interesting, I have been thinking about something like that
> > myself. Any chance of contributing it to Cocoon?
> 
> I will ask around here if we have already committed it (otherwise, we
> will do so soon I am pretty sure)

Cool!

> 
> Anyway, attached (hope it works to attach, otherwise will mail its
> plain text) is the ExpiresCachingProcessingPipelineNew you can use.
> This one actually is capable of delivering 1000 hits a sec on cocoon
> on pretty modest hardware, which is regardless the complexitity of the
> pipelines it caches (the old one does not perform well because it
> initializes still all included pipes testing for validities and cache
> keys, while, for the expiring pipeline you already know this: You
> define the cachekey yourself AND you say how long it is valid.) 
> 

Yep, that's exactly what I was looking for.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: is it possible to cache sql queries?

2006-03-15 Thread Bruno Dumon
On Tue, 2006-03-14 at 23:04 +0100, Ard Schrijvers wrote:
> > Yeah, good call.  I was actually thinking of something that could 
> > override the caching on an entire pipeline.  Then it could be 
> > used for 
> > other things like grabbing rss feeds or something.  For example:
> > 
> > 
> >   
> >   ...
> > 
> > 
> 
> Don't build it yourself!! There is just a pipeline exactly doing what you 
> want: Use the exiring pipeline:
> 
>  src="org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline">
>  
> 
> 
> Now use :
> 
>  
>   
>  your matchers here...
> 
> That is all: 
> 
> In the cache-key you can also take request-params like:   name="cache-key" value="{0}-{request-param:page}" /> 
> 
> There is certainly no need to write your own caching mechanism for
> this...if this cached result is not returned fast enough from cocoon,
> since cache-key lookups and validity checks are still done we have a
> (probably not yet committed to cocoon) version of the
> ExpiresCachingProcessingPipeline performing MUCH faster for complex
> pipelines. 

This is interesting, I have been thinking about something like that
myself. Any chance of contributing it to Cocoon?

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Question about pipelineUtil and viewdata

2006-03-15 Thread Bruno Dumon
On Tue, 2006-03-14 at 20:44 +, Duncan McLean wrote:
> Hi
> 
> Scenario: I want to construct a viewdata object that I can pass to a
> pipeline then have that data passed to the page (an xsp) in the called
> pipeline
> 
> So I would have:
> 
> cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
>  var result = pipelineUtil.processToDOM(myuri, viewData);

Instead of PipelineUtil, you can use the processPipelineTo function of
the FOM. See also the docs over here:
http://cocoon.apache.org/2.1/userdocs/flow/api.html

> 
> somewhere in flow, then I would want this viewdata to be passed to an xsp
> in the matched pipeline, to allow the xsp to function correctly.
> 
> Can someone give me an example of how this can be done - presumably I
> could then read the viewdata object within the xsp?

I have no experience using it, but this should do the job:
http://cocoon.apache.org/2.1/userdocs/flow/jpath.html

BTW, in most cases, JXTemplate is the preferred template language for
Cocoon, unless of course you need some functionality that only exists in
XSP.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: XML messaging

2006-03-14 Thread Bruno Dumon
On Tue, 2006-03-14 at 17:50 +0100, Bertrand Delacretaz wrote:
> Le 13 mars 06 à 19:46, Yves Vindevogel a écrit :
> 
> > ...A message is an XML file, on which you have to respond.  Your  
> > response is basically answering what you received and reporting  
> > errors if they occur...
> 
> In the java world a good tool for this is JMS, an interface to  
> message buses which provide asynchronous guaranteed delivery,  
> transaction support, etc.
> 
> There is a JMS block in Cocoon, I don't know much about it but its  
> code can certainly be used as a starting point. Anyway accessing a  
> JMS bus from java is fairly easy.
> 
> Also, Daisy (the Cocoon-based CMS) uses a JMS bus internally, you  
> might want to have a look at their code for examples. They use  
> openjms for the bus IIRC, http://openjms.sourceforge.net/
> 
> AFAIU, ServiceMix (http://servicemix.org/) goes in the same  
> direction, you might also want to have a look at what they do.

Other similar projects:
 * http://mule.codehaus.org/
 * https://www.openadaptor.org/

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: fd:output - outputting a formatted number

2006-03-14 Thread Bruno Dumon
On Tue, 2006-03-14 at 10:40 -0600, Brian Maddy wrote:
> Hi,
> 
> I am using the output widget to output a number to the user.  I would 
> like to format it so it looks like this 1,234,567 instead of 1234567.  I 
> figured this would be a styling thing, but couldn't find anything in the 
> docs.  I've also tried the following, but it doesn't seem to work:
> 
> 
> units:
> 
> 
> 
> ###,###
> 
> 
> 
> 
> Anyone know how to do something like that?

The fd:convertor needs to be inside the fd:datatype:

http://cocoon.apache.org/2.1/userdocs/widgetconcepts/datatypes.html

Also, I thought the formatting convertor is the default, so I would
suppose that this happens without doing any effort.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Dynamic CForm with HTML-Tags in Initial-Value

2006-03-14 Thread Bruno Dumon
On Tue, 2006-03-14 at 11:39 +0100, Moritz Kobel wrote:
> On Sat, 11 Mar 2006 12:48:27 +0100
> Bruno Dumon <[EMAIL PROTECTED]> wrote:
> 
> > On Fri, 2006-03-10 at 19:35 +0100, Moritz Kobel wrote:
> > > Hi,
> > > 
> > > i'm writing a simple content management system with the html-editor
> > > tiny-mce instead of htmlarea. on one page there are multiple
> > > content-fields possible, so i generate the template & definition
> > > file with data from a sql database.
> > > when i fill up the inital-value with html code from the database
> > > all the html-tags are removed.
> > > 
> > > can somebody give me a hint how to solve this problem? i found no
> > > solution seeking the mailinglist and asking google.
> > 
> > If the fields use the string datatype, then make sure the HTML is in
> > escaped form, i.e. something like <html><body> ...
> > 
> > Not sure if this is the problem though, as you would need to do
> > special effort for having it not escaped.
> > 
> 
> Thank you... it works!
> 
> if somebody has the same problem:
> using postgresql i've this part in the query:
> 
> [...]
> replace(replace(encode(v.content,'escape'),'<','&lt;'),'>','&gt;')
> as content
> [...]
> 
> (v.content is a bytea)

hmmm, IIUC you are escaping the XML double (and it seems not correct:
you need to escape every ampersand, not just < and >) because when
retrieving it from the database, you will be parsing it again. Why not
just remove the parsing?

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: No ajax, but page with long repeater...

2006-03-11 Thread Bruno Dumon
On Fri, 2006-03-10 at 14:42 -0500, David Park wrote:
> Using cocoon 2.1.8, here is the problem:
> 
> Say a form has a repeater with many rows. If there is a repeater-action 
> at the bottom that adds a new row, clicking it causes a form submit, and 
> the user ends up at the top of the page, where the new row sits at the 
> bottom of the page.
> 
> Likewise, if the repeater rows themselves have nested repeaters, any 
> action that causes a form submission leaves the user at the top of the 
> page, in a different "context", if you will, than where they performed 
> the "submit action".
> 
> Is it possible, without ajax, to have a page submission target the 
> widget that was "acted upon"?
> 
> Is CForms able to output an  that is 
> targeted somehow via an http://my_continuation_url#repeater-row-id?
> 
> Many thanks to anyone who has any assistance to offer.

Another approach I once used in the past was to store the scroll
position (in pixels) in a hidden input field when submitting the form,
and restoring it when displaying the form.

You could add a hidden field widget for this purpose.

Here's some code I found back:


  var storeScrollOnSubmitHandler = new Object();
  storeScrollOnSubmitHandler.forms_onsubmit = function() {
  var scrollPos = window.pageYOffset; // Mozilla
  if (scrollPos == undefined) {
  if (document.compatMode &amp;&amp; document.compatMode != 
"BackCompat")
  scrollPos = document.documentElement.scrollTop;
  else
  scrollPos = document.body.scrollTop;
  }
  if (scrollPos != undefined) {
  document.forms["editdoc"].scrollPosition.value = scrollPos;
  }
  };
  forms_onsubmitHandlers.push(storeScrollOnSubmitHandler);

  var setScrollPosHandler = new Object();
  setScrollPosHandler.forms_onload = function() {
  function restoreScroll() {
  var scrollPos = document.forms["editdoc"].scrollPosition.value;
  if (scrollPos != null &amp;&amp; scrollPos != "")
 window.scrollTo(0, scrollPos);
  }
  setTimeout(restoreScroll, 200);
  }
  forms_onloadHandlers.push(setScrollPosHandler);


This code assumes there's a field called "scrollPosition" on a form
named "editdoc", so you'll need to change at least that. I see the
restore is done via a timeout -- I don't remember why that was, you
might try to remove that. Also I just changed some things to the
restoreScroll function which might not work (e.g. it could be that you
need to parse the scrollPos to a number). Anyhow, this should get you
started.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Dynamic CForm with HTML-Tags in Initial-Value

2006-03-11 Thread Bruno Dumon
On Fri, 2006-03-10 at 19:35 +0100, Moritz Kobel wrote:
> Hi,
> 
> i'm writing a simple content management system with the html-editor
> tiny-mce instead of htmlarea. on one page there are multiple
> content-fields possible, so i generate the template & definition file
> with data from a sql database.
> when i fill up the inital-value with html code from the database all the
> html-tags are removed.
> 
> can somebody give me a hint how to solve this problem? i found no
> solution seeking the mailinglist and asking google.

If the fields use the string datatype, then make sure the HTML is in
escaped form, i.e. something like <html><body> ...

Not sure if this is the problem though, as you would need to do special
effort for having it not escaped.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: handling errors in parts

2006-03-10 Thread Bruno Dumon
On Thu, 2006-03-09 at 14:37 -0500, Justin Hannus wrote:
> Bruno Dumon wrote:
> 
> >what do you refer to with 'pipelines' here? The other map:part's?
> >Transformers after the map:aggregate?
> >
> >  
> >
> Yes, the other map:parts.

Then that's impossible. It will stop at the first part that throws an
exception.

>  The src attribute points to points to another 
> pipeline with cocoon://. Please see my first post as it has an 
> example at the bottom. I re-posted the same thread omitting the example 
> for brevity.
> 
> >>cocoon:// request will continue processing as if no error has occurred 
> >>but. you will still see the cocoon error page as if processing 
> >>actually stopped!
> >>
> >>I have a pipeline which aggregates several other pipelines and then 
> >>writes the generated content to disk. If there is an exception in one of 
> >>the aggregate parts I need the sitemap processing to stop and handle the 
> >>exception appropriately. Instead the generated content, which has 
> >>errored and therefore invalid, is still written to disk. If I remove the 
> >>aggregate pipeline and just use a regular generator the handle-errors is 
> >>respected correctly and processing stops before writing the content.
> >>
> >>Am I misusing the  elements? Or is this the expected 
> >>behavoir?
> >>
> >>
> >>
> >
> >I have no experience with map:aggregate, but from a quick look at the
> >code, it doesn't catch any exceptions. What it does always do (also when
> >an exception occurs) is closing the root tag and sending the end
> >document event.
> >
> >  
> >
> That would explain why exceptions are caught and handled after the 
> aggregate parts are executed, as if things went fine, and concatenated 
> instead of being caught and handled by the map:handle-errors defined in 
> the erroring piepline.

As I wrote, the exceptions are not caught, so it is impossible that
map:parts that follow the one which gives an error are executed.

> 
> BTW: can you point out the file and line you found this on. I've been 
> digging but with no luck yet.

It really doesn't matter, as there's nothing to fix there. While I do
think that sending additional SAX-events after an exception occured is
wrong, changing this will not cause a reliable alternative behaviour, as
the resulting behaviour would just be a coincidence of implementation
details of other transformers. Don't forget the SAX-pipeline is
streaming, you can't pull back events which are already forwarded to the
next transformer.

This being said, ContentAggregator.generate() is where it happens.

> 
> >Now I'm just going to guess wildly (since you didn't mention), but if
> >after the map:generate you have an XSLT transformer and you write the
> >content using the source writing transformer, I can image the file
> >indeed still gets written. This is because on the one hand Xalan can
> >cope with the invalid input, and the endDocument event will cause it to
> >do the transform and thus cause the source writing transformer to do its
> >job.
> >  
> >
> Exactly correct. Please see my first post as it has an example at the 
> bottom. I re-posted the same thread omitting the example for brevity.
> 
> >While the close-root-tag-and-send-end-document-event behaviour of the
> >aggregate is debatable, it is the nature of a SAX-pipeline that
> >everything in the pipeline starts executing together. Therefore things
> >which have side-effects and for which error recovery is important should
> >not be done in a streaming pipeline (therefore the source writing
> >transformer is considered an evil one -- don't use it).
> >
> >  
> >
> I've also tried some other experiments with aggregate map:parts calling 
> pipelines and setting request attributes. It seems as if a new Request 
> object is created for each map:aggregate part.

While Cocoon does create a request object wrapper for each internal
request ("cocoon:" request), most things, including setting request
attributes, are delegated to the original request object (at least, I'd
be very suprised if it's different).

>  Therefore setting a 
> request attribute in a pipeline when called from a map:part is not 
> visible to other map:parts or the original pipeline

Careful here: if you set a request attribute in say, a generator of a
pipeline called from a map:part, and read it out in (e.g.) an action in
the original pipeline, then that won't work indeed.

This has to do with how the sitemap works, the following resource might
help you unde

Re: handling errors in parts

2006-03-09 Thread Bruno Dumon
On Thu, 2006-03-09 at 12:52 -0500, Justin Hannus wrote:
> I can't seem to get an aggregate pipeline part to respect or handle 
> errors correctly when an
> exception occurs in one of the aggregate parts. It almost seems as if 
> its impossible. This is
> whats happening...
> 
> When an exception occurs in the a pipeline which is called as one of the 
>  part elements, the erroring pipeline or parent pipelines 
> do not handle the errors correctly. In fact, the  is 
> completely ignored. What happens is the sitemap processing continues 
> even after the exception occurs and, eventually the main entry matching 
> pipeline's  is invoked. This is bad because when using a 
> cocoon:// request as your  src any pipelines under that 

what do you refer to with 'pipelines' here? The other map:part's?
Transformers after the map:aggregate?

> cocoon:// request will continue processing as if no error has occurred 
> but. you will still see the cocoon error page as if processing 
> actually stopped!
> 
> I have a pipeline which aggregates several other pipelines and then 
> writes the generated content to disk. If there is an exception in one of 
> the aggregate parts I need the sitemap processing to stop and handle the 
> exception appropriately. Instead the generated content, which has 
> errored and therefore invalid, is still written to disk. If I remove the 
> aggregate pipeline and just use a regular generator the handle-errors is 
> respected correctly and processing stops before writing the content.
> 
> Am I misusing the  elements? Or is this the expected 
> behavoir?
> 

I have no experience with map:aggregate, but from a quick look at the
code, it doesn't catch any exceptions. What it does always do (also when
an exception occurs) is closing the root tag and sending the end
document event.

Now I'm just going to guess wildly (since you didn't mention), but if
after the map:generate you have an XSLT transformer and you write the
content using the source writing transformer, I can image the file
indeed still gets written. This is because on the one hand Xalan can
cope with the invalid input, and the endDocument event will cause it to
do the transform and thus cause the source writing transformer to do its
job.

While the close-root-tag-and-send-end-document-event behaviour of the
aggregate is debatable, it is the nature of a SAX-pipeline that
everything in the pipeline starts executing together. Therefore things
which have side-effects and for which error recovery is important should
not be done in a streaming pipeline (therefore the source writing
transformer is considered an evil one -- don't use it).

The alternative approach is to use flowscript and its processPipelineTo
function, where you can use a try-catch block and remove the file (if
needed) when an error occurs.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: Tab Order in CForms

2006-03-09 Thread Bruno Dumon
On Thu, 2006-03-09 at 17:05 +, Stewart, Gary wrote:
> > I havn't ever tried it, but you can add the tabindex 
> > attribute just like
> > any other, for example:
> > 
> > 
> >   
> > 
> > 
> > The stylesheets simply copy over all the attributes they don't
> > understand to the target input element.
> > 
> > There's also a shorter way of writing this, if you don't have 
> > any nested
> > elements in fi:styling (which is usually the case):
> > 
> > 
> 
> That looks like a good way to go about it; thanks. Gave it a go and it looks 
> like it is working fine on the forms (though it might be a little tedious to 
> change when I make changes to forms I might create a stylesheet to automate 
> adding the attributes to widgets; I can post it when I've done it and if 
> anyone else is interested. 
> 
> However I'd still like to know how I can get access to the cocoon
> resource link since I was also looking at changing the HTMLArea (and
> possibly replacing it with Xinha). 
> 

The resources can be found in:

src/blocks/forms/java/org/apache/cocoon/forms/resources/

What you can do is copy that directory to your own project, and change
the forms resource matcher in your sitemap to read the resources from
the new location. Then you can easily adjust them and try out the
changes (for client-side resources such as javascript, don't forget that
the browser caches these).

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Tab Order in CForms

2006-03-09 Thread Bruno Dumon
On Thu, 2006-03-09 at 15:58 +, Stewart, Gary wrote:
> Does anyone know how to change the tab order in CForms? I was hoping
> to change it so it ignores the links (such as the help and error
> links) until it gets all the way to the bottom of the form. I'd assume
> you'd do this by altering the tab order in the final HTML form. I
> figure I should be looking at the forms styling to do this. I can't
> actually find where forms-page-styling.xsl and
> forms-advanced-field-styling.xsl are located though. Any clue as to
> where to look and maybe how to implement this?
> 

I havn't ever tried it, but you can add the tabindex attribute just like
any other, for example:


  


The stylesheets simply copy over all the attributes they don't
understand to the target input element.

There's also a shorter way of writing this, if you don't have any nested
elements in fi:styling (which is usually the case):



-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Dynamically generating arabic texts with svg2png serializer

2006-03-04 Thread Bruno Dumon
Hi Fred,

thanks for confirming this works, and for reminding me about this issue
which I was almost forgotten.

On Tue, 2006-02-28 at 23:17 +0100, Fred Vos wrote:
> Hello Bruno,
> 
> Thank you so much for your help. I've got it working now! Sorry I didn't
> respond earlier.
> 
> On Wed, Feb 15, 2006 at 09:28:17AM +0100, Bruno Dumon wrote:
> 
> [...]
> 
> > 
> > I have had the same experience. While request parameters and post-bodies
> > are decoded correctly, the URL path itself is not.
> 
> After reading this, I thought I could solve the problem by moving the Arabic
> text to a request parameter. You've suggested this solution too in a private
> message to me. But this didn't work.
> 
> > 
> > This can be fixed though.
> > 
> > If you are running Jetty, supply the following parameter to the java
> > command line:
> > -Dorg.mortbay.util.URI.charset=UTF-8
> > 
> > If you are running Tomcat, you can do the same by editing
> > conf/server.xml, and on the Connector element (for http), add the
> > attribute URIEncoding="UTF-8".
> 
> I'm using Tomcat 5.0. I have multiple connectors for virtual hosts. This
> attribute must be set for every connector.
> 
> > 
> > Now, this will make that URL paths are correctly decoded as UTF-8.
> > However, this also means that request parameters will be decoded as
> > UTF-8, while Cocoon normally supposes the servlet container decodes them
> > as ISO-8859-1 and then corrects this itself.
> > 
> > The solution I have is to add a servlet filter which will set the
> > character encoding to UTF-8. Here's the source for such a filter:
> > 
> > package my;
> > 
> > import javax.servlet.*;
> > import java.io.IOException;
> > 
> > public class CharacterEncodingFilter implements Filter {
> > private String encoding;
> > 
> > public void init(FilterConfig filterConfig) throws ServletException {
> > encoding = filterConfig.getInitParameter("encoding");
> > }
> > 
> > public void doFilter(ServletRequest servletRequest, ServletResponse 
> > servletResponse, FilterChain filterChain) throws IOException, 
> > ServletException {
> > if (servletRequest.getCharacterEncoding() == null && this.encoding 
> > != null) {
> > servletRequest.setCharacterEncoding(this.encoding);
> > }
> > filterChain.doFilter(servletRequest, servletResponse);
> > }
> > 
> > public void destroy() {
> > }
> > }
> > 
> > Compile this, put it in a jara, put in in WEB-INF/lib. Edit the web.xml
> > file and add the following before the opening  element:
> > 
> >   
> > encoding-filter
> > my.CharacterEncodingFilter
> > 
> >   encoding
> >   UTF-8
> > 
> >   
> > 
> >   
> > encoding-filter
> > /*
> >   
> > 
> > In the same web.xml file, adjust both the form-encoding and
> > container-encoding parameters to be UTF-8 (these elements are already
> > there, don't add new ones):
> > 
> > 
> >   container-encoding
> >   UTF-8
> > 
> > 
> > 
> >   form-encoding
> >   UTF-8
> > 
> 
> At first cocoon didn't work after this. But your suggestion in a private
> message to me was right. The class wasn't located in the right directory in
> the jar. I uses javac and jar here and not Eclipse or Maven.
> 
> > 
> > (The container-encoding is now UTF-8 since the filter has instructed the
> > container to decode everything as UTF-8, while per default it will use
> > ISO-8859-1. This is needed because we otherwise can't destinguish
> > between the UTF-8 decoded URL and the ISO-8859-1 decoded post body)
> > 
> > And this should make everything working correctly.
> 
> It does!
> 
> > 
> > BTW, I have found out all this only very recently and will take up the
> > discussion on the dev list to make this the default in Cocoon.
> 
> Please do. I think Cocoon should use UTF-8 wherever possible.
> 
> شكراً
> = Shukran
> = Thank you 
> 
> Fred Vos

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Organizing own project in cocoon?

2006-03-04 Thread Bruno Dumon
On Thu, 2006-03-02 at 12:21 +0100, [EMAIL PROTECTED] wrote:
> I read that what’s recommended is to create a block for one’s project.
> 
> But as I see it, one needs no modify ant files, web.xml etc., so
> upgrading
> 
> to a new version of cocoon becomes a mess.
> 
> Is there any clean way of using cocoon?
> 

I wouldn't use it as a block, since as you indicated this requires
modifying the original Cocoon source tree.

I'm a bit suprised I didn't see a reference yet to this:

http://cocoon.zones.apache.org/daisy/cocooninaction/14.html

which is a solution that allows to easily build cocoon (with your own
build options), adjust configuration with xpatch, builds your java code,
copies resources, etc. This is an updated version of the
"YourCocoonBasedProject" thing on the Cocoon Wiki.

This is pretty similar to what Simone suggested, but the Ant script you
can download there is immediately useable, in a couple of minutes you're
up and running.

This solution also allows to easily 'switch' cocoon versions, e.g. to
try it out with a new cocoon version.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: LinkRewriterTransformer question

2006-03-02 Thread Bruno Dumon
On Thu, 2006-03-02 at 15:58 +0100, Martijn C. Vos wrote:
> Bruno Dumon [mailto:[EMAIL PROTECTED] wrote:
> >  
> >  I would like to use the LinkRewriterTransformer to transform 
> >  links like
> >  this:
> >  
> >  myscheme:somevalue
> >  
> >  to something like
> >  
> >  http://someserver/some/path/somevalue
> >  
> >  Thus, the 'somevalue' should simply be prefixed with a static string.
> >  
> >  This seems like a pretty basic use case but I couldn't figure out how
> >  one of the standard input modules of Cocoon could do this. 
> >  Does anyone
> >  know if this is possible?
> 
> Sounds like a pretty standard use for the linkrewriter. The way I use it
> is this:
> 
> The input module (cocoon.xconf):
> 
>  
> class="org.apache.cocoon.components.modules.input.LocationMapModule" 
>   logger="core.modules.lm">
> 
>   
> 
> Linkrewriter (sitemap.xmap):
> 
>name="linkrewriter"
> pool-grow="2" pool-max="32" pool-min="2"
> src="org.apache.cocoon.transformation.LinkRewriterTransformer">
> linkmap
> href action value src
>   
> 
> And a linkmap that contains stuff like:
> 
>   
> 
>   
> 
> Or something like that. I may be forgetting something, and I give no 
> guarantees
> that this is correct, but this is what my code looks like, and it seems to 
> work.
> 
> In the end, links like 
>   linkmap:/content/foo/blah.xml
> should be rewritten as
>   /bar/blah.html.
> 

Thanks a lot, that's exactly what I was looking for.

However, I think you got the classpath for the LocationMapModule wrong,
as it seems to be part of Forrest:
org.apache.cocoon.components.modules.input.LocationMapModule

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: LinkRewriterTransformer question

2006-03-02 Thread Bruno Dumon
Euh, my question was not about namespaces, but about what input module
could do the transformation I gave in the example. Anyhow, I guess the
answer is there isn't any, so I'll have to come up with my own.

On Wed, 2006-03-01 at 11:52 -0600, Antonio Gallardo wrote:
> Hi Bruno,
> 
> LinkRewriter and namespaces is a hell due xpath 1.0. We have been 
> working on that for months [1].
> 
> Best Regards,
> 
> Antonio Galllardo
> 
> [1] https://issues.apache.org/jira/browse/COCOON-1616
> 
> Bruno Dumon wrote:
> 
> >Hi,
> >
> >I would like to use the LinkRewriterTransformer to transform links like
> >this:
> >
> >myscheme:somevalue
> >
> >to something like
> >
> >http://someserver/some/path/somevalue
> >
> >Thus, the 'somevalue' should simply be prefixed with a static string.
> >
> >This seems like a pretty basic use case but I couldn't figure out how
> >one of the standard input modules of Cocoon could do this. Does anyone
> >know if this is possible?
> >
> >Thanks.
> >
> >  
> >

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



LinkRewriterTransformer question

2006-03-01 Thread Bruno Dumon
Hi,

I would like to use the LinkRewriterTransformer to transform links like
this:

myscheme:somevalue

to something like

http://someserver/some/path/somevalue

Thus, the 'somevalue' should simply be prefixed with a static string.

This seems like a pretty basic use case but I couldn't figure out how
one of the standard input modules of Cocoon could do this. Does anyone
know if this is possible?

Thanks.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: files in upload-directory being deleted

2006-02-28 Thread Bruno Dumon
On Tue, 2006-02-28 at 13:54 +, Andrew Le Quesne wrote:
> Hello,
> 
> I have a web app which uses the CForms upload widget to upload files,
> which it is saving in the
> 
> Upload-directory I have specified in the webapp’s WEB-INF/web.xml
> file.
> 
> The application is running in Jetty and whenever Jetty is restarted
> any files in this upload directory are deleted.
> 
> It seems from my subsequent research on the internet that the
> upload-directory is only a temporary folder and that if I want to save
> them permanently they will either need to be moved or saved
> separately.
> 
> Can anyone confirm whether or not this is correct, or is there in fact
> a way to stop them being deleted in the first place?

The upload directory is indeed only a temporary storage.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: error in cocoon-2.1.7..

2006-02-21 Thread Bruno Dumon
On Tue, 2006-02-21 at 07:36 -0700, Jason Johnston wrote:
> [EMAIL PROTECTED] wrote:
> > Hi Simone,
> > 
> > The same stuffs seem to be working with cocoon2.1.5.
> > Anything we need to add with cocoon 2.1.7 to make this work.
> > Please suggest us something so that we go ahead and try out with cocoon
> > 2.1.7.
> >
> 
> It's really impossible to tell what is going wrong without seeing the
> flowscript function in question.  Something is causing the function to
> exit without sending a response, but who knows what without seeing the code.
> 

In earlier Cocoon versions (don't know up till when exactly) it was
allowed to call a flowscript which didn't do a sendPage(AndWait) or
redirect. The execution of the sitemap would then continue after the
map:call.

This behaviour has been disabled, discussions about this can be found in
the dev mail list archive, basically because it was an inconsistent or
unexpected behaviour.

So if this is the cause of the problem, the only solution is to adjust
the flowscripts.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Dynamically generating arabic texts with svg2png serializer

2006-02-15 Thread Bruno Dumon
-8

  

  
encoding-filter
/*
  

In the same web.xml file, adjust both the form-encoding and
container-encoding parameters to be UTF-8 (these elements are already
there, don't add new ones):


  container-encoding
  UTF-8



  form-encoding
  UTF-8


(The container-encoding is now UTF-8 since the filter has instructed the
container to decode everything as UTF-8, while per default it will use
ISO-8859-1. This is needed because we otherwise can't destinguish
between the UTF-8 decoded URL and the ISO-8859-1 decoded post body)

And this should make everything working correctly.

BTW, I have found out all this only very recently and will take up the
discussion on the dev list to make this the default in Cocoon.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: How to return a JDom document from a action? [SOLVED]

2006-02-03 Thread Bruno Dumon
On Thu, 2006-02-02 at 18:59 +0100, Tino Breddin wrote:
> Hi,
> 
> first i would like to thank you all for your pointers to a solution. I'm 
> happy that it works now.
> 
> The solution is to put a DOM object instead of a JDOM object into the 
> request. That was easy to create by using the DOMOutputter from JDOM. 
> Now i get the xml fragment i wanted, with both access methods,  .../> and ${request...}.

The XMLizable approach should be more efficient though, especially for
non-trivial trees.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: How to return a JDom document from a action?

2006-02-02 Thread Bruno Dumon
On Thu, 2006-02-02 at 07:33 -0700, Jason Johnston wrote:
> Andre Juffer wrote:
> > Tino Breddin wrote:
> >> Hi,
> >>
> >> i tried your way:
> >>
> >> Request request = ObjectModelHelper.getRequest(objectModel);
> >>Session session = request.getSession(true);
> >>session.setAttribute("testparamsession",doc);
> >>
> >> Then:
> >> ${session.getAttribute('testparamsession')}
> > 
> > It should be something like
> > 
> > ${cocoon.session.getAttribute("testparamsession")}
> > 
> > assuming that you doc in the action contains a proper (J)DOM document
> > and the session was properly created.
> 
> Before we go any farther down this path, I don't think getting access to
> the object is the problem; it seemed pretty clear from his original
> example that he was already successfully getting access to the object,
> but it is just not being serialized in the way he expects.
> 
> I haven't tried it to verify, but I believe to have a DOM document get
> serialized into the XML stream you need to use  value="${request.getAttribute('testparamrequest')}" /> since the jx:out
> element treats certain objects like DOM documents specially whereas the
> ${} expression just calls toString() or something like that.

${} should also work. The problem is rather that it is a JDOM object,
not a DOM object. JXTemplate does not recognize JDOM objects.

What you could do is wrap the JDOM object in an object that implements
the XMLizable interface, that is:

org.apache.excalibur.xml.sax.XMLizable

this is a simply interface with just a toSAX method.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: need help for cform tutorial

2006-02-02 Thread Bruno Dumon
On Thu, 2006-02-02 at 21:13 +0700, zulhisham abu nawar wrote:
> On 2/2/06, christian bindeballe <[EMAIL PROTECTED]> wrote:
> > zulhisham abu nawar schrieb:
> > > On 2/2/06, christian bindeballe <[EMAIL PROTECTED]> wrote:
> > >> zulhisham abu nawar schrieb:
> > >>
> > >>> Registration form Registration form Registration form Registration
> > >>> Name: Name: Email address: Email address: Your age: Your age:
> > >>> Password: Password: Re-enter password: Re-enter password: Send me
> > >>> spamfalse Send me spam Registration Name: Name: Email address: Email
> > >>> address: Your age: Your age: Password: Password: Re-enter password:
> > >>> Re-enter password: Send me spamfalse Send me spam Registration Name:
> > >>> Name: Email address: Email address: Your age: Your age: Password:
> > >>> Password: Re-enter password: Re-enter password: Send me spamfalse Send
> > >>> me spam
> > >>
> > >> Hi,
> > >>
> > >> I had the same output once, in Cocoon 2.1.7. I couldn't get the Sample
> > >> to work. When I upgraded to 2.1.8, everything worked out fine. Which
> > >> version are you using? Would be helpful to know...
> > >
> > >i'm using version 2.1.7 run on tomcat 5.0.28. So should i move to 
> > > 2.1.8 now??
> >
> >
> > I can't guarantee that it'll work, but since the samples I copied from
> > the documentation on the web didn't work, but after an update, they did,
> 
> i already install version 2.1.8 and the tutorial can work. But i
> wonder that why the block in samples can work but the tutorial
> can't

Because with 2.1.7 you use the samples of release 2.1.7, and with 2.1.8
you use the samples of 2.1.8. The example in the documentation has been
updated for the latest release, which is 2.1.8.

Not that a lot has changed, but IIRC the location of the resources has
changed a little bit. I'm not sure, but I guess the imports of the
common XSLs are failing, in which case you should see errors in the
cocoon log (in WEB-INF/logs).

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: selectionList sort order

2006-02-01 Thread Bruno Dumon
What styling option do you use for the multivaluefield?

Maybe the double-listbox styling? In that case the options are indeed
sorted, by the client-side javascript, since otherwise it wouldn't know
where to put the items as they are moved from one listbox to the other
(unless it would remember the original list, which is not impossible but
requires some additional implementation effort).

The other stylings (listbox, checkboxes) do not reorder items AFAICS.

On Wed, 2006-02-01 at 11:48 -0700, Bruyn Bill wrote:
> Is the problem statement clear?  Is this the intended behavior, or am
> I doing something wrong?  I scanned the source and didn't see anything
> obvious.  FWIW, here is the widget definition (not much to it):
>  
> 
>Languages
>
>
> 
>  
> BTW, the list contains some ListOption objects, whose method getId
> returns a java.lang.Integer and getOptionLong returns a
> java.lang.String.
>  
> Thanks again for your time.
>  
> 
> Bill
> 
> 
> 
> From: Bruyn Bill [mailto:[EMAIL PROTECTED]
> Sent: Tue 1/31/2006 2:56 PM
> To: users@cocoon.apache.org
> Subject: selectionList sort order
> 
> 
> 
> I have a multivaluefield with a selection list, bound with some
> fb:javascript.  The contents of the list are sorted the way I want them
> when I obtain the list, but are rendered differently.  Snippet follows:
> 
>
> 
>
>   var list = facade.getListOptions(Language.LIST_NAME);
>   for(var i = list.iterator(); i.hasNext();) {
> print(i.next().getOptionLong());
>   }
> 
>   /* yields the following, as desired:
>  
> English
> ASL or other assistance for hearing impaired
> Achumaw
>*/
>  
>   widget.setSelectionList(list, "id", "optionLong");
>  
>   /* but is rendered in the following order:
>  
> ASL or other assistance for hearing impaired
> Achumaw
> English
>   */
>
>  
>   
> 
> 
> Anybody know offhand where/why this is happening and how to stop it?
> Thanks in advance.
> 
> 
> Thanks,
> 
> Bill Bruyn

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Simlpe forms question (I hope)

2006-01-24 Thread Bruno Dumon
On Tue, 2006-01-24 at 11:32 +, Duncan McLean wrote:
> Hi
> 
> How can I set a default value for a radio button?
> In this example we have 2 options (Single, Joint), and want Single to be
> default.
> 
> I know we can set the value in flow, but this would mean that the value
> would always be set to that value wouldn't it? What I mean is that if we
> take the example above, and the user clicked "Joint" and submitted the
> form, then subsequently returned to that form, the flow code would
> kick in and reset the value back to "Single" losing the users choice - or
> am I incorrect in that assumption?
> 
> Here's the relevant fragment of the form def:
> 
> 
>   Is this policy a Single Life or Joint Life 
> policy?
>   
>   
>   
>   
>   
>   
> 
> I was hoping that "Single" would
> work, but no luck.
> 
> Any suggestions on how this can be achieved?

fd:initial-value should work, at least if you are using Cocoon 2.1.8 (I
don't know exactly in which version this feature was introduced).

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: [CFORMS] dynamic binding

2006-01-20 Thread Bruno Dumon
On Fri, 2006-01-20 at 08:21 +0100, werner wrote:
> Am Donnerstag, den 19.01.2006, 11:27 -0700 schrieb Jason Johnston: 
> > > Does anybody know a clean approach for dynamic binding. For example it
> > > would be nice to use a JXTemplate for the binding and pass it some vars
> > > like it works with showForm:
> > >
> > > form.createBinding("binding.jx", {"param1": somevalue, "param2":
> > > somevalue});
> > >
> > > I know it's possible to solve this with a special pipline and call the
> > > binding with /binding.jx/param1/param2
> > > But that's ugly IMO.
> 
> Thanks for your answer Jason.
> 
> > 
> > Looks like somebody posted a patch for this feature:
> > https://issues.apache.org/jira/browse/COCOON-1418
> > 
> > In the meantime you can use request attributes or parameters as a
> > transport for your data.
> 
> That's how I'm doing it right now. But in some cases that is not
> enough. Especially when you want to pass more than 3 parameters to the
> binding.
> 

I'm not sure what kind of dynamism you need, but if it is in the JXPath
expressions you can pass parameters to the binding along with your
'bussiness object':

form.load({"data": dataObject, "param1" : "value1", "param2" :
"value2"});

In the binding you'll then need to adjust the fb:context to start form
"/data". The parameters are accessible in JXPath expressions using e.g.
"/param1".

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: general.field-required translation not working

2006-01-18 Thread Bruno Dumon
On Wed, 2006-01-18 at 07:29 -0700, Jason Johnston wrote:
> Joost Kuif wrote:
> > Hi,
> > 
> > I'm using cforms and trying to override the general.field-required
> > message for the empty but 'required' (in formdefinition) fields. 
> > I have the line below in a messages.xml:
> > 
> > Dit is een verplicht
> > veld.
> > 
> > For testing purposes: If i specify this key in a label of a field, the
> > string "Dit is een veplicht veld" is correctly translated for this
> > field-label. So cocoon is able to find the needed key in my messages.xml
> > with the keys i specify in the formdefinition. 
> > 
> > Only the translation for required="true" in the  tag is NOT
> > translated into a proper message if a user leaves a (required) field
> > empty.
> >  
> > AFAIK this should be handled somewhere in the forms*.xsl pages.
> > Unfortunalely i cannot find the problem. Can someone help me? Thanks a
> > lot!
> > 
> > 
> > Joost.
> > 
> > 
> > Example:
> > The code below works, the specified label is overruled by the one in my
> > messages.xml:
> > 
> > 
> > this should be
> > overruled
> > 
> 
> 
> The i18n elements produced by CForms all have an attribute 
> i18n:catalogue="forms", which means that the i18n transformer will 
> always look for a catalogue configured with the id "forms" to get its 
> translations for these elements.  The example above works because you're 
> not telling it to use a specific catalogue, so it uses whichever default 
> catalogue you have configured in your sitemap.
> 
> You need to have something like this in your sitemap:
> 
>  src="org.apache.cocoon.transformation.I18nTransformer">
> 
>
>
> 
> 
> 
> And make sure your overridden CForms messages are in the "forms" 
> catalogue.  See the I18nTransformer docs for more details about setting 
> up catalogues.

More specifically,  it is also possible to avoid duplicating the entire
forms catalogue by having a config like this:



   
 path/to/custom-i18n
 resource://org/apache/cocoon/forms/system/i18n
   
   



The path/to/custom-i18n directory would contain a file called
messages(_lang).xml in which you only need to redefine the messages you
want to change.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Error- Accessing widgets in flowscript

2006-01-16 Thread Bruno Dumon
On Mon, 2006-01-16 at 16:51 +0100, [EMAIL PROTECTED] wrote:
> Hello,
> 
> I have some difficulties accessing the widget values in the flow script. 
> 
> var form = new Form("registration_definition.xml");
> var wid = form.getWidget();
> wid.message.value = cocoon.parameters.defaultMessage;

You need to do:

wid.getChild("message").value = ...

> 
> The last call throws this exception: 
> org.mozilla.javascript.EcmaError: Cannot convert null to an object.
> 
> When I access the same widget in an jscript block in the form_definition
> there is no problem. 
> 
>  
> var msg = this.lookupWidget("../message");
>  msg.value = "Selecting." + + event.newValue ;
> 
> 
> What is the problem here? 
> I use the sitemap form the simple form example of the user guide.
> 
> cheers,
> 
> Pete
> 
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Error in org.apache.cocoon.xml.dom.DOMStreamer.NamespaceNormalizingDOMStreamer or xerces DocumentImpl

2005-11-23 Thread Bruno Dumon
On Tue, 2005-11-22 at 16:47 +0100, Michael Wirz wrote:
> Hello Coocon User Mailing List,
> 
> During cocoon app development the following error arose using DOM-Documents
> and the SAX-Streaming of cocoon. Since I am not sure if its a bug in cocoons
> DOM->SAX Streamer or the Document Implementation of xerces I'd like to show
> it to you first. Maybe you can help deciding if it is to be forwarded to
> cocoon-dev
> or another place.
> 
> I built a DOM - Tree using the xerces DocumentImpl Documt-Class.
> I then added a root Node with a Text Element, initialized (erratically)
> with null.
> see below:
> 
> Document doc = new DocumentImpl();
> Element e = doc.createelement("rootNode");
> doc.appendChild(e);
> e.appendChild(doc.createTextNode(null));
> 
> This has been a valid DOM-Document and could be serialized using the
> org.apache.xml.serialize.XMLSerializer and written to a file successfully.
> 
> When using this DOM-Tree in an  in cocoon a NullPointerException
> occurred:
> 
> Original Exception: java.lang.NullPointerException
>   at 
> org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.dispatchChars(DOMStreamer.java:264)
>   at 
> org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.startNode(DOMStreamer.java:471)
>   at 
> org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.stream(DOMStreamer.java:229)
>   at org.apache.cocoon.xml.dom.DOMStreamer.stream(DOMStreamer.java:150)
>   at 
> org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper.xspExpr(XSPObjectHelper.java:309)
>   at ... the xsp-compiled java src ...
> 
> I took a look at
> *org.apache.cocoon.xml.dom.DOMStreamer.NamespaceNormalizingDOMStreamer.
> dispatchChars looks like this:
> 
> private final void dispatchChars(Node node) throws SAXException {
> String data = ((Text) node).getData();
> contentHandler.characters(data.toCharArray(), 0, data.length());
> }
> 
> If getData() yields null, subsequent calls will fail; resulting in my
> NullPointerException.
> 
> I fixed my DOM-Tree making things work.
> Do we have to fix it in
> **org.apache.cocoon.xml.dom.DOMStreamer.NamespaceNormalizingDOMStreamer?
> Or is the DOM invalid according to the DOM Spec, in other words: is a
> null-Data-Element allowed in a TextNode?

You could look it up yourself too :-) I just had a quick look at the DOM
spec, but for me it is unclear whether it is allowed to be null or not.
It is not mentioned that it cannot be null, but it is neither mentioned
that it can be null, while other methods that do allow null values for
arguments do mention this.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Form Description, Form Template & Repeater

2005-11-18 Thread Bruno Dumon
On Thu, 2005-11-17 at 19:11 +0100, Omar Adobati wrote:
> Thanks for the answers, I changed the code in:
> 
> 
>  
>
>  
>
>
>  
>
>  
>  
>
>  
>
>
>  
>
>  
>  
> 
> but I have an error that sounds quit like the one I have before:
> Repeater 'TelNumbers' has no child named 'TelNumbers'
> 
> why?

Hmm... I get the impression that you're just randomly trying out tags
without understanding what they do.

Have a look at the example here (below the header "From Cocoon 2.1.8"):
http://cocoon.apache.org/2.1/userdocs/widgets/widget_repeater.html

Thus:
 1. your code is missing the ft:repeater-rows tag.
 2. if you want to insert the widget labels inside each row, then you
need to do the usual 

> 
> 
> On 11/17/05, Myriam Delperier <[EMAIL PROTECTED]> wrote:
> > | | hello,
> > | | I think that in the template :
> > | |  should be replaced by
> > | | ,
> > | | same thing for .
> >
> > in fact the good value is : 
> >

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: how to start pipeline processing from dom element

2005-11-16 Thread Bruno Dumon
On Wed, 2005-11-16 at 14:36 +0100, Askild Aaberg Olsen wrote:
> cocoon.erard wrote:
> 
> >hello, 
> >
> >I've e dom Element and like to start the pipeline processing from
> this Element. How can I do that? Do I have to write a Generator?
> >
> >Regards 
> >
> >Mike 
> >
> >  
> >
> If it's from flow, you can use pass the dom element to a jx-template 
> generator like this:
> 
> In flow:
> cocoon.sendPage("pipelineWithJX", {"domElement" : domElement})
> 
> In jx:
> 
>  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>#{domElement}

Another option: start the pipeline with:



-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Integer formatting

2005-11-08 Thread Bruno Dumon
On Tue, 2005-11-08 at 08:11 +0200, Derek Hohls wrote:
> Bruce
>  
> I struggled some time back with getting years displayed as 
> format and not .0 - in the end I used:
>  
> 
>  
> to get what I needed.  This syntax seems a little different from
> what you are using - maybe it will help?

fyi: the datatype attribute is only relevant when using a convertor in a
binding definition. Otherwise the datatype is defined implicitely by the
fd:datatype element in which the fd:convertor is used. It won't do harm
the attribute is there, but it is not used and does not serve any
purpose.


> 
> 

the variant attribute here has no purpose, the plain convertor does not
need any further configuration. The variant attribute is specific to the
formatting convertor. Again, does no harm if it is there (but can
confuse).

> 
>  value-path="value" label-path="label" />
> 
> 
> what comes out in the HTML is:
> 
>  name="queueList.0.instance">
> 1
> 2
> etc...
> 
> Note the floating point value. When submitting the form, the dropdown 
> ends up with an exclamation point beside it because it doesn't pass 
> validation, 1.0 not being an integer value.
> 
> I can fix the problem by using Java types rather than the javascript 
> variables in the flow. So this renders as integers in the HTML rather 
> than floats:
> 
> formData.queueList = [
> {value: new Integer(1), label:"1"},
> {value: new Integer(2), label:"2"},
> {value: new Integer(3), label:"3"}
> ];
> 
> but it strikes me as a weird behaviour.
> 
> Is this expected, or is it a bug? What is the recommended
> implementation 
> for this?

This is expected behaviour. The type of the objects in the selection
list should match the datatype of the widget. The only reason you got so
far is that the plain integer convertor doesn't try to cast the object
to an Integer (nor does the flow jxpath selection list implementation
check the type of the objects in the list). So yes, you need to use the
java types.

> 
> P.S. I know that I don't need a convertor in this particular case,
> but 
> I am trying to be consistent in how integers are handled and I don't 
> want commas in integers under any circumstances. There are lots of
> other 
> places where my integers can go over four digits.


-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Sharing is caring... selection-list for country codes?

2005-11-06 Thread Bruno Dumon
On Sat, 2005-11-05 at 15:53 +0100, Antonio Fiol Bonnín wrote:
> 2005/10/11, Sylvain Wallez <[EMAIL PROTECTED]>:
> > Mark Lundquist wrote:
> > > I need an XML file with an  full of country name =>
> > > ISO country codes...
> > >
> > > So, who's got one? :-)
> >
> > If you have one, I'll happily include it in the Cocoon forms jar, so
> > that you could write
> >  > src="resource://org/apache/cocoon/forms/system/util/country-codes.xml"/>
> 
> What would be the Right(tm) approach for internationalized country names?

It is possible to retrieve this information using the java.util.Locale
class, for example, here's a short program to list the countries in
french:

import java.util.Locale;

public class Countries {
  public static void main(String[] args) {
Locale targetLocale = new Locale("fr");
String[] countries = Locale.getISOCountries();
for (int i = 0; i < countries.length; i++) {
  System.out.println(new Locale("",
  countries[i]).getDisplayCountry(targetLocale));
}
  }
}

However, from what I see, far from all country names are translated into
all languages (probably only the country names where those languages are
actually spoken).

While at it, I've tried the same using the ULocale class from the icu4j
library, which does seem to contain much more (or complete?) localized
information.

So a good approach would be to have a selection list implementation that
tests if the ULocale class is available and otherwise falls back to the
Locale class. Some other things to take care of are sorting the country
names alphabetically and possibly some caching if needed. Alternatively,
we could once run a program which pre-generates selection list data for
all desired languages.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re:

2005-10-27 Thread Bruno Dumon
On Wed, 2005-10-26 at 13:31 -0400, Ben Anderson wrote:
> Hi,
> So I was trying to put javascript validation right into my form
> definition, but ran into some funkiness (at least from my
> perspective).
> 
> First of all I realized that putting the javascript in a field doesn't
> "invalidate" the form:
> 
> Here's my form definition:
>   
> 
>   failed on form
>   cocoon.log.debug("form returning false");
>   return false;
> 
>   
>   
> 
>   action
>   
>   
> 
>   cocoon.log.debug("widget returning false");
>   return false;
> 
>   
> 
> 
> What's interesting is that both log messages are printed.  However, if
> I change the  on the form to return true then
> widget.isValid() returns true even though my action field still
> returns false.  CForms online documentation for  says
> to consult the examples in the source.  I only found one example and
> it is directly under the form (not the widget).
> 
> Question #1: This leads me to believe that maybe I can't put
>  under the  element?
> 
> Also, the  element was wishful thinking on my part
> which doesn't seem to do anything.  The xml of the form looks the same
> after the forms transformer whether I return true or false.  
> 
> Question #2: Using  for validation, is there a way to
> get messages printed out at all let alone something useful like this
> 
> 
>   if (!someDAO.getOrders().size() > 0) {
> // send "must attach order" message
>   } else if (!someOtherDAO.isValidCustomer()) {
> // send "must register first" message
> ...
> 
> Maybe I'm just pushing the limits of the javascript validator... any
> ideas?

In the javascript validation (or in any validation for that matter), if
you return false, you should also set a validation error on the widget
to which the validator belongs, or a child/descendant widget of that
widget (e.g. in case the validator belongs to a form or repeater).

Have a look at the source of the samples for how to do this.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: loop thru woody repeaters

2005-10-24 Thread Bruno Dumon
On Mon, 2005-10-24 at 14:46 +0100, Gunter D'Hondt wrote:
> Hi,
> 
> I want to loop thru a woody repeater it's instances in plain old java 
> code; doing a form.getWidget("repeatername") doesn't give me much methods 
> to do that I think?

you need to cast it to a repeater:

Repeater repeater = (Repeater)form.getWidget("repeatername");

and then use getRow(index) and getSize() methods

> 
> So:
> a repeater with widgets "id" and "name"; data: 
> id name
> 1  abc
> 2  def
> 
> and using java flow I want to set the data to:
> id name
> 1  111
> 2  222
> 
> 
> 
> Minor detail: Cocoon 2.1.4
> 
> Regards,
> Gunter D'Hondt

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: POST Generator or Transformer?

2005-10-19 Thread Bruno Dumon
On Wed, 2005-10-19 at 14:34 +0100, Stewart, Gary wrote:
> Had a look at the documentation but I'm probably just missing
> something. Is there a transformer (or generator) that can send a HTTP
> Post request to another server and generate a stream from the returned
> results? I figured that since that's kinda the format that SOAP
> requests are made there probably is but I couldn't find it.

You can do so with the cinclude transformer. Supply a parameter named
"method" with value "POST", something like this:

  
    method
POST
  

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: java out of memory with OBJECT/quicktime movie

2005-08-17 Thread Bruno Dumon
On Mon, 2005-08-15 at 15:22 +0200, Johannes Schaefer wrote:
> Hi!
> 
> I get an out-of-memory error for movies above a certain size
> (around 10MB):
>   15:18:41.906 WARN!! Error for .../movs/madagascar.mov
>   java.lang.OutOfMemoryError: Java heap space
> 
> Smaller movies don't make problems.
> 
> How can I increase the heap size for Cocoon?
> 
> 
> If it is caching: Can I turn caching off only for the *.mov
> matcher?
>   
> 
>   
> 

Have a look at this:

http://wiki.apache.org/cocoon/ServingLargeFiles

You indeed need to disable caching, but also configure reasonable
request output buffering.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Injecting a String XML document into a pipeline

2005-06-05 Thread Bruno Dumon
On Fri, 2005-06-03 at 16:46 -0500, Sebastien Arbogast wrote:
> Hi,
> 
> I'm looking for a simple way to inject the string content of a
> flowscript variable into a pipeline for serialization and sending. Of
> course I could do a sendPage() but that would force me to :
> 1 - create a dummy JXTemplate to inject the value of my flow variable
> 2 - create an XSLT stylesheet to extract the content again.
> 
> In other words, I'm in my flowscript function, I have a variable which
> contains exactly the XML document I want to send to the client. How
> can I do that ?

By using the module source. The module source is a source which finds
its input by using an input module. It can handle InputStreams, strings
or byte arrays.

Start the pipeline with a generator like this:



But since you have the XML already completely as you want to send it to
the client, you can directly use a reader which avoid the parsing and
serializing:



One possible issue might be encoding. If your XML string doens't contain
an encoding declaration, then an XML parser will treat it as UTF-8 so
the string should be converted to bytes using UTF-8. The module source
however uses whatever the platform default encoding is, so to avoid
problems it is better to convert to bytes already in your flowscript:

sendPage("...", {"myxml": myxmlvar.getBytes("UTF-8")});

(if your XML string does contain an encoding declaration, replace UTF-8
by whatever it specifies)

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Re. Dynamic generation of CForms

2005-04-07 Thread Bruno Dumon
On Thu, 2005-04-07 at 14:39 +0200, Mattom wrote:
> Ok, so I do aggregate the form defintion and template to one xml !?
> 
> I tried this with the sample from the 
> http://cocoon.apache.org/2.1/userdocs/forms/sample.html, aggregating the 
> form definition with the template in an new  and then 
> passing it through the xslt transformer mentioned in
> http://cocoon.apache.org/2.1/userdocs/forms/xslt.html
> Nothing dynamic here ok, but, one xml as definition, and one as template...
> 
> I do get some output, but actually the form template does not know about 
> the form definition... is there any sample for the XSLT way of 
> publishing CForms (nothing in the blocks/samples/forms) ?

You need to approach it differently, basically do everything as in the
normal CForms samples, but where you usually supply the filename of the
form definition, you need to put a "cocoon:" URL to fetch the form
definition from a pipeline.

Thus in flowscript that would give something like:

var form = new Form("cocoon:/my-form-definition-generation-pipe");

whereby you would then in the sitemap have a matcher that matches
"my-form-definition-generation-pipe" which contains a pipeline to
generate the form definition.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Apples block does not have sendPageAndWait

2005-04-01 Thread Bruno Dumon
On Fri, 2005-04-01 at 13:51 +0200, Leszek Gawron wrote:
> gkrishna wrote:
> > The apples block does demonstrate the flow control even when a user with 
> > what if attitude presses 'browser back button' or clone a page.
> > 
> > there is no sendPageAndWait functionality in the Apples example 
> > CalculationApple.java. It only uses sendPage function.
> > 
> > sendPage is used normally for terminating the flow. ie., user should not be 
> > able to change the values of the shopping cart after the submit button is 
> > pressed. But the javascript does the same through k.invalidate(), 
> > but in java it is not the same case.
> There is no sendPageAndWait in Apples because Apples flow controller is 
> stateless. If you want to build stateful applications you have to manage 
> state yourself and store the information in session for example.

Apples is stateful, not stateless. You don't need the session to store
information, you can just put it in instance variables of the apple.
Apples doesn't do continuations, therefore there's no sendPageAndWait
method, each new request starts at the beginning of the apples' process
method.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Returning large datasets via SQL Transformer?

2005-03-15 Thread Bruno Dumon
On Tue, 2005-03-15 at 15:14 +0200, Derek Hohls wrote:
> Irv
> 
> Unfortunately there are no errors in the log file... and no
> exceptions I can see.  I would have thought an OutOfMemoryException

it's actually an OutOfMemoryError, which is important, because errors
are not logged by Cocoon. You need to check the logs of your servlet
container (eg catalina.out) or the console if you're using the bundled
jetty.

Certainly given the size of your query result, the likeliness of an OOME
is very high. If you have a pipeline that works streaming (eg. SQL
transformer followed by no XSLTs and just an XML serializer on the end)
you can put the pipeline in a non-caching pipeline and use the
outputBufferSize parameter to avoid buffering (just search mailing list
archives for more information).

If you do use XSLs and/or non-streaming serializers (eg FOP or POI),
increase the amount of memory of the JVM till it works.

> might be itbut no reports of that.  The query itself can take a
> few
> minutes to run (1.25 min in the MySQL command line).  I tried both a 
> file download and opening in the browser; but each time the result
> was simply a completely empty file.
> 
> Any other obvious flaw?
> 
> Thanks
> Derek
> 
> >>> [EMAIL PROTECTED] 2005/03/15 02:07:45 PM >>>
> When you say you get an empty file, are there any errors in the log or
> exceptions that you can see?  Something tells me you are probably
> getting an OutOfMemoryException or something along those lines?  The
> other thing that comes to mind is that this could take a long time. 
> Is the browser still working on it, or did it truly come back with an
> empty file?
> 
> Irv
> 
> 
> On Tue, 15 Mar 2005 11:36:15 +0200, Derek Hohls <[EMAIL PROTECTED]>
> wrote:
> > Using Cocoon 2.1.6 on Linux...
> > 
> > I am having a problem attempting to return a large
> > set of data, via the SQL transformer, from a MySQL
> > database, through Cocoon.
> > 
> > A query such as :
> > SELECT * FROM mytable LIMIT 100
> > works fine, but if I remove the limit and attempt to
> > retrieve the entire table - some 25000 rows of 30
> > floating point data fields - I just get an empty file.
> > 
> > Is there a limit built-into either  the SQL transformer
> > or Cocoon that needs to be changed to allow a
> > larger volume of data to be downloaded
> > 
> > Thanks
> > Derek
> > 
> > PS Yes, I do have to have the entire record set...
> > 
> >
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Encoding Problem: File Upload and UTF-8

2005-03-07 Thread Bruno Dumon
On Mon, 2005-03-07 at 12:33 +0100, stefan pickschneider wrote:
> Hey Bruno,
> 
> >>I am not sure if the above patch fixes the problem I mentioned.
> >>
> >>The patch replaces
> >>   this.defaultFormEncoding);
> >>by
> >>   this.containerEncoding);
> >>
> >>In our configuration the
> >>defaultFormEncoding == containerEncoding == "UTF-8" - so the patch
> >>doesn't seem to have a influence on our problem :-(
> > 
> > 
> > then your configuration is wrong :-) The containerEncoding should be
> > ISO-8859-1, always.
> > 
> Ok. So this option is for future use or if you really know, what
> your webcontainer is doing.

I assume it is for broken web containers, that don't follow the spec.

> 
> > 
> >>Somewhere the encoding for the Parameters is set to ISO-8859-1 probably 
> >>because no encoding is set until the first call of getParameter*().
> > 
> > 
> > Cocoon doesn't rely on the setCharacterEncoding support of the
> > webcontainer, basically because of historical reasons, that method
> > didn't always exist. Additionally, Cocoon's approach has the advantage
> > that it allows to change the encoding from the sitemap, allowing
> > different parts of the sitemap to use different encodings.
> > 
> I tried it this way. Normal forms (not multipart/form-data) are 
> submitted correctly with ISO-8859-1 (containerencoding) decoded to UTF-8 
> (formencoding).
> 
> Multipart forms instead seem to send the form fields as UTF-8. Cocoon 
> tries to decode these too from ISO to UTF - so they break and i doesn't 
> work.
> 
> Ok, so for our problem a solution would like:
> ContainerEncoding ISO-8859-1
> FormEncoding UTF-8
> 
> For all forms that use "multipart/form-data" & utf-8: use the 
> SetCharacterEncodingAction in the sitemap to change the encoding to utf-8.
> 
> Unfortunately SetCharacterEncodingAction is only able to change
> the FormEncoding - not the ContainerEncoding - so that this way wouldn't
> work without enhancing the action.
> 
> 
> Are there any other ways?

It should work the same for both normal and multipart forms, without use
of the SetCharacterEncodingAction. You do need the fix though I pointed
to in a previous mail, since that one is not yet in Cocoon 2.1.6 IIRC.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Encoding Problem: File Upload and UTF-8

2005-03-07 Thread Bruno Dumon
On Mon, 2005-03-07 at 11:02 +0100, stefan pickschneider wrote:
> > This problem is already fixed, though in a different way:
> > 
> > http://svn.apache.org/viewcvs.cgi/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=106200&r1=55730&r2=106200
> 
> Hey Bruno,
> 
> thanks for your reply.
> 
> I am not sure if the above patch fixes the problem I mentioned.
> 
> The patch replaces
>this.defaultFormEncoding);
> by
>this.containerEncoding);
> 
> In our configuration the
> defaultFormEncoding == containerEncoding == "UTF-8" - so the patch
> doesn't seem to have a influence on our problem :-(

then your configuration is wrong :-) The containerEncoding should be
ISO-8859-1, always.

> 
> Somewhere the encoding for the Parameters is set to ISO-8859-1 probably 
> because no encoding is set until the first call of getParameter*().

Cocoon doesn't rely on the setCharacterEncoding support of the
webcontainer, basically because of historical reasons, that method
didn't always exist. Additionally, Cocoon's approach has the advantage
that it allows to change the encoding from the sitemap, allowing
different parts of the sitemap to use different encodings.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Limit on file size for download of tar.gz

2005-03-07 Thread Bruno Dumon
On Sun, 2005-03-06 at 17:57 +0100, Yves Vindevogel wrote:
> Hi,
> 
> I've put some tar.gz files online under a Cocoon directory.
> Files are rather large (> 20 meg).
> 
> When I request one, my browser (Firefox on Mac, but also others) ask me 
> what to do, I say "save" and it starts  but it creates an empty 
> file instead of downloading things.
> 
> Mime type is "application/x-gzip", and it's in a  
> 
> Tia

Put the matcher for your download in a pipeline like this:

   
 
 ...

Search in Cocoon's root sitemap for "outputBufferSize" to see some more
info about this.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Encoding Problem: File Upload and UTF-8

2005-03-07 Thread Bruno Dumon
On Sun, 2005-03-06 at 20:46 +0100, stefan pickschneider wrote:
> Bertrand Delacretaz wrote:
> > Le 5 mars 05, à 15:17, stefan pickschneider a écrit :
> > 
> >> ..we have a problem with the encoding, cforms and file uploads.
> > 
> > 
> > Did you look at http://wiki.apache.org/cocoon/RequestParameterEncoding ?
> > It might give some answers.
> > 
> > -Bertrand
> 
> Hello,
> 
> thanks for your suggestion - it helped me to find a "solution".
> 
> It seems that the cocoon servlet initializes the container-encoding for 
> the request too late, so that the default encoding iso-8859-1 is used 
> for reading the parameters. These are incorrectly decoded, since 
> container-encoding and form-encoding are set to UTF-8 in web.xml.
> All forms etc. are UTF-8, too.
> This problem only happens if you're using "application/x-www-
> form-urlencoded" as enctype. For "multipart/form-data" it works, because
> MultipartHttpServletRequest doesn't try to decode parameters.
> 
> Solution:
> In CocoonServlet.java around line 1040 insert
>  // set encoding before parameters are accessed
>  request.setCharacterEncoding(this.containerEncoding);
> before
>   // Get the cocoon engine instance
>  getCocoon(request.getPathInfo(), 
>   request.getParameter(Constants.RELOAD_PARAM));
> 
> 
> Hope someone needs it and it is not too dirty ;-)
> Stefan.
> 

This problem is already fixed, though in a different way:

http://svn.apache.org/viewcvs.cgi/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=106200&r1=55730&r2=106200

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: SV: Only one syntax for xpointers in xincludes?

2005-02-23 Thread Bruno Dumon
On Wed, 2005-02-23 at 12:06 +0100, Claus Bech Rasmussen - TELMORE wrote:
> > 1. it's not supported by Cocoon. I suppose the xpointer 
> > attribute is something that got added in a recent version of 
> > the spec (at least, more recent then the last update to 
> > Cocoon's implementation).
> 
> Are there any plans of supporting this construct?

I don't think so.

>  
> > 2. lookups based on IDs are not supported, since this would 
> > require validating the document against a DTD. The 
> > alternative is to use something like 
> > //[EMAIL PROTECTED]'my.element.id'], which should work equally well.
> 
> Yes, I tried that approach and it works fine.
> 
> My problem is that the XML editor used by the people contributing
> documents only supports the xpointer attribute, so I'm trying to figure
> out whether to hack the editor, Cocoon or - hopefully - neither.
> 
> Maybe I should do an intermediate transformation that changed the syntax
> of the xinclude?

That's an option.

> 
> /claus

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Only one syntax for xpointers in xincludes?

2005-02-23 Thread Bruno Dumon
On Wed, 2005-02-23 at 11:34 +0100, Claus Bech Rasmussen - TELMORE wrote:
> Hi folks,
> 
> I'm using xincludes in documents served up by Cocoon (Well, by Forrest,
> actually). I've read
> http://cocoon.apache.org/2.1/userdocs/transformers/xinclude-transformer.
> html but have a question about the syntax of xpointers in xincludes:
> 
> The only thing that I can get to work is what's described in the above
> document:
> 
> 
> 
> What I would like to do is to use the xpointer attribute and just point
> to an ID in the target doc:
> 
> 
> 
> However, when I try this syntax, the entire document is included. Is
> this the intended behavior?

There are two problems with this approach:

1. it's not supported by Cocoon. I suppose the xpointer attribute is
something that got added in a recent version of the spec (at least, more
recent then the last update to Cocoon's implementation).

2. lookups based on IDs are not supported, since this would require
validating the document against a DTD. The alternative is to use
something like //[EMAIL PROTECTED]'my.element.id'], which should work equally 
well.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: i18n error messages

2005-02-20 Thread Bruno Dumon
On Sat, 2005-02-19 at 12:27 +0100, Mark Lowe wrote:
> To respond to my own thread it appears to have required fields
> localised then you need to use a really bleeding edge version of
> cackoon,

cocoon is the name

>  like the head version out of svn, as if cforms are bleeding
> edge enough.

I suggest you take the branch "BRANCH_2_1_X", which should be relatively
stable. The real bleeding edge development is going on in the trunk.

>  I don't blame cforms, they are new, I blame the indivdual
> who chose it as a technology.
> 
> I imagine its something to do with the toSax method in I18nMessage. 

There's a good chance it has something to do with a bug in the
ParamSaxBuffer class, which was fixed after the 2.1.6 release. So you
could also take just the last version of that class from SVN and put it
over the source of the 2.1.6 download.

> 
> Mark
> 
> On Thu, 17 Feb 2005 10:33:29 +0100, Mark Lowe <[EMAIL PROTECTED]> wrote:
> > Just to clarify then all you cocoon disciples display
> > general.field-required for required fields?

I guess they do :-) Seriously, I don't know how long the bug has been in
there, but someone reported it in bugzilla and contributed a patch,
which is now applied.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Forms V2 foolishness

2004-11-29 Thread Bruno Dumon
If I were you I wouldn't loose too much time on v2, since it will be
removed in the future. The non-v2 api is the one you should use.

On Mon, 2004-11-29 at 12:39 +, Andrew M wrote:
> 
> 
> __
> 
> Any ideas?
> On 29 Nov 2004, at 11:18, Andrew M wrote:
> 
> Any ideas anybody?
> 


-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: Using htmlArea 'output' with SVG

2004-11-24 Thread Bruno Dumon
On Tue, 2004-11-23 at 15:09 +0100, [EMAIL PROTECTED] wrote:
> Derek,
> 
> I'm currently working on updating the HTMLarea sample to 
> 1. work in tables in IE6
> 2. use Bruno's HtmlCleanerConvertor
> 3. output html-ized data, rather than raw (i.e. as string)
> 
> for 3. I currently use a simple XSL stylesheet that matches  tags
> and displays them with disable-output-escaping="yes". If anyone can come up
> with a better solution or modifies Ugo's HTMLparser, please do so.

Again and again, if you have XML as a string and want to push it over
the pipeline, and have it recognized as 'XML' (SAX events), you need to
parse it, using an XML parser. Using disable-output-escaping is a trick
of which I'm very suprised it even works inside Cocoon, and certainly
wouldn't like to see used in the Cocoon samples.

There are various solutions:
* parse the XML in the flowscript and pass the result as a DOM or a
SaxBuffer to the view
* embed (x/c)include statements in the template that address the
to-be-embedded XML using the module source
* or use a class like the StringXMLizable attached with this message,
and use it like this in the template:

#{mypackage.StringXMLizable.new(/myobject/mystring)}

this essentially wraps a string (here addressed as /myobject/mystring)
and turns it into an XMLizable object. This of course supposes that the
string contains well-formed XML.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]
package mypackage;

import org.apache.excalibur.xml.sax.XMLizable;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.InputSource;

import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.StringReader;

public class StringXMLizable implements XMLizable {
private String data;

public StringXMLizable(String data) {
this.data = data;
}

public void toSAX(ContentHandler contentHandler) throws SAXException {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
parserFactory.setNamespaceAware(true);
SAXParser parser = null;
try {
parser = parserFactory.newSAXParser();
} catch (ParserConfigurationException e) {
throw new SAXException("Error creating SAX parser.", e);
}
parser.getXMLReader().setContentHandler(contentHandler);
InputSource is = new InputSource(new StringReader(data));
try {
parser.getXMLReader().parse(is);
} catch (IOException e) {
throw new SAXException(e);
}
}
}

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

Re: Using htmlArea 'output' with SVG

2004-11-24 Thread Bruno Dumon
On Wed, 2004-11-24 at 09:25 +0100, Ugo Cei wrote:
> Derek Hohls wrote:
> > Brunor - I thought Ugo was the once who came up 
> > with the code we were talking about - its called "HTMLparser"
> > (was attached to a previous email) ... what is the difference
> > between these two??
> 
> Without having seen Bruno's code, the difference is probably that mine 
> is a quick and dirty solution that got the job done for me when I needed 
> it, whereas Bruno's is a reusable, well-documented, efficient component :)

Nah, the HtmlCleaner serves a different purpose alltogether. It starts
with parsing the input using NekoHTML, but then performs further
filtering, conversion and restructuring on it to have a nice output,
limitted to a subset of the HTML dtd. At the end it serializes it
pretty, ie whitespace collapsing, line breaks at a certain width, etc.

One consequence is that if you enter the same text in Mozilla or IE,
you'll get the same textual output (there's still some small things left
that need to be fixed), allowing to do source-diffs on the edited
content.

Thus the end result is a string (or byte array) which will need to be
parsed again.

If you want to allow any HTML, not limited to a certain (configurable)
subset of the HTML DTD, simply use plain NekoHTML.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Problem with cForms and validation

2004-11-15 Thread Bruno Dumon
Try moving the fd:validation tags out of fd:datatype (so that they are
siblings of fd:datatype). The validation has been refactored from
datatype validators to more general widget validators, and the
compatibility to support the old syntax seems to be broken.

On Mon, 2004-11-15 at 21:10 +0100, Emond Papegaaij wrote:
> Hi,
> 
> We are using cForms with the standard cForms validation for some time now. A 
> couple of days ago I decided to upgrade to the latest Cocoon snapshot, 
> however with this snapshot the validation doesn't work as expected anymore. 
> Somewhere a change has been made to the way Cocoon handles validation of 
> fields that were left blank. It now tries to validate a null reference, which 
> leads to a NullPointerException. I've seen this happen with 'normal' text 
> fields, fields with a converter to Integer, aggregate fields with fd:regexp 
> and with custom validation classes.
> 
> I don't think it makes sense to validate a null reference as it should always 
> be considered correct when the field is not required. Reverting to Cocoon 
> 2.1.5.1 solved it, so it's definitely a problem introduced somewhere in the 
> new Cocoon version. Is it a bug or is it the way it's supposed to be? It 
> makes the combination of validation with non-required fields quite useless.
> 
> Best regards,
> Emond Papegaaij
> 
> Here is a snapshot of the definition of a field that is causing problems when 
> left blank:
> 
>   Postcode
>   
>   
> 
> 
>   
>   
>   
> 
>   Postcode
>   
> 
>   
> CUT ERROR
>   
> 
>   
> 
> 
>   
> 
>   
> CUT ERROR
>   
> 
>   
> 
>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: JXTemplateGenerator and CForms

2004-10-25 Thread Bruno Dumon
On Sat, 2004-10-23 at 06:37 -0700, Paul Joseph wrote:
> Hi,
> 
> I am trying to use the JXTemplateGenerator with CForms
> (Cocoon 2.1.5.1) in order to conditionally display
> widgets.
> 
> >From the following URL:
> http://cocoon.apache.org/2.1/userdocs/forms/templategenerator.html
> 
> I understand that this should be possible as it says: 
> 
> 
> The same "ft:" tags as provided by the template
> transformer are also available as macros for the
> JXTemplate generator.
> 
> 
> However when I try this,
> (JXTemplateGenerator->XSLT->Serialise), I get
> complaints that the ft: tags are not bound
> 
> Question:  Is it possible to use JXTemplateGenerator
> combinded with CForms to conditionally diplay
> widgets...and, when using the
> JXTemplateGenerator->XSLT->Serialise 
> approach, how does one bind the CForm widgets?

This works, but currently not in any released version, see this message
for more information:
http://article.gmane.org/gmane.text.xml.cocoon.devel/41191

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: multivalue list - set a value greater than 1000

2004-10-07 Thread Bruno Dumon
On Thu, 2004-10-07 at 05:36, Joe Latty wrote:
> I think you will find that the value is being formatted with 1,000
> (hence no match) try adding this to your multivaluefield
> 
> 
>   
>
>  ###
>
>
> 


or simply use the "plain" convertor, which is locale-independent:


  


The source of the problem however is that the formstransformer uses a
different locale then the the one used when processing a form submit.

> 
> -Original Message-
> From: Paul Joseph [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 7 October 2004 1:23 PM
> To: Cocoon Users
> Subject: multivalue list - set a value greater than 1000
> 
> Hi,
> 
> I have a multivalue widget that is populated with a
> list of id's and labels.
> 
> The id's are integers with values greater between 1
> and 16000.
> 
> The widget saves to the database properly and the list
> loads.
> 
> However, if a selected widget has a value greater than
> 1000, while it saves correctly to the database, I am
> unable to set the value.  It seems to silently ignore
> setting values over 1000.
> 
> ex. this does not seem to work:
>   myInt1 = new java.lang.Integer(1000);
>   model.dicttype_group[i].otherassignees=[myInt1];
> 
> But if I use 999, it works.
> 
> Is this a bug by any chance?
> 
> thx!
> Paul
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: continuation woes

2004-10-01 Thread Bruno Dumon
On Thu, 2004-09-30 at 10:06, Jorg Heymans wrote:
> Adam Walsh wrote:
> > Hi Jorg,
> > 
> > That scenario makes perfect sense. In step 1, you're actually updating 
> > the model of your form by removing the element. Step 2 you're jumping 
> > back and seeing an old view of your form model that is no longer valid. 
> > In step 4 you're effectively just refreshing your view on the model, so 
> > it won't show the element that you removed previously. It's not actually 
> > being removed again, it's presenting the updated repeater widget with 
> > the element missing that you removed in step 1.
> this makes sense .
> 
> But why can't I reproduce this behaviour in the CForms samples then? Try 
> playing with the contact repeater at the bottom, it does not have this 
> "feature".
> http://localhost:/samples/blocks/forms/form1

that sample doesn't use flowscript, nor does it store the form model
server side between requests, iow it is stateless. On each request, it
creates a fresh form instance and fills it up with the data from the
request.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Configuring the HTMLarea for table operations

2004-09-07 Thread Bruno Dumon
On Tue, 2004-09-07 at 08:51, Derek Hohls wrote:
> Bruno
> 
> I have now tried the following:
> 
> 1. Create an external js file with the following:
> 
> 
> // Register plugins
> HTMLArea.loadPlugin("TableOperations");
> HTMLArea.loadPlugin("FullPage");
> 
> function initFunction(areaID) { 
>   // inititalize editor 
>   editor = new HTMLArea("editor"); 
>   // retrive the config object 
>   var config = editor.config; 
>   config.statusBar = false;
>   // do custom configuration 
>   config.toolbar = [
>   [ 
> "bold", "italic", "underline", "strikethrough",
> "separator",
> "subscript", "superscript", "separator",
> "justifyleft", "justifycenter", "justifyright",
> "separator",
> "insertorderedlist", "insertunorderedlist", "outdent",
> "indent", "separator",
> "createlink", "separator", "undo", "redo", "paste"  ]
>   ];
>   HTMLArea.replace(areaID,config);
> }
> 
> function initTable(areaID) { 
>   // inititalize editor 
>   edit = new HTMLArea("editor");
>   edit.registerPlugin(TableOperations);  
>   // retrive the config object 
>   var config = edit.config; 
>   config.statusBar = false;
>   // do custom configuration 
>   config.toolbar = [
>   [ 
> "bold", "italic", "underline", "strikethrough",
> "separator",
> "subscript", "superscript", "separator",
> "justifyleft", "justifycenter", "justifyright",
> "separator",
> "insertorderedlist", "insertunorderedlist", "outdent",
> "indent", "separator",
> "createlink", "separator", "undo", "redo", "paste"  ]
>   ];
>   HTMLArea.replace(areaID,config);
> }  
> 
> 2. Linked to that file via a call from the primary stylesheet:
> 
>  src="{$resources}/htmlareaconfig.js">
> 
> But I still have the same issue ie. those text areas using
> function  initFunction() work fine, but those trying to use the
> initTable() , which calls the registerPlugin(TableOperations)
> do not!

the easiest way to debug this kind of problem is to use mozilla or
firefox and look at the javascript console.

One thing I do differently is put the tableoperations between quotes:
edit.registerPlugin("TableOperations");

though it should work without them too.

> 
> I did look on the HTMLarea forums, and the advice there was 
> the same as yours, but there must be something else needed 
> to  make it work?  eg. how does HTMLArea know where to 
> locate  the plugins?

just check the htmlarea.js source, you'll see.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Configuring the HTMLarea for table operations

2004-09-06 Thread Bruno Dumon

On Mon, 2004-09-06 at 16:54, Derek Hohls wrote:
> If anyone has experience with the problem below,
>  I'd appreciate hearing a solution..
> 
> I have modified the forms-htmlarea-styling.xsl to 
> include the following  - inserted after the line:
>  src="{$resources-uri}/htmlarea/htmlarea.js">
> 
> 
>   //reconfigure HTMLArea toolbar
>   function initTable(areaID) { 
> // inititalize editor 

do first:
HTMLArea.loadPlugin("TableOperations");

note: if you have multiple htmlareas on one page, this only has to
happen once, so in that case you might rather do this in some <script>
in the <head> tag.

> edit = new HTMLArea("editor");
> edit.registerPlugin(TableOperations);  
> // retrive the config object 
> var config = edit.config; 
> config.statusBar = false;
> // do custom configuration 
>   config.toolbar = [
>   [ 
> "bold", "italic", "underline", "strikethrough",
> "separator",
> "subscript", "superscript", "separator",
> "justifyleft", "justifycenter", "justifyright",
> "separator",
> "insertorderedlist", "insertunorderedlist", "outdent",
> "indent", "separator",
> "createlink", "separator", "undo", "redo", "paste"  ]
>   ];
> HTMLArea.replace(areaID,config);
>   } 
> 
> 
> The form template page is then configured to use it
> for a textarea as follows:
> 
>
>  initTable
>  
> 
> However the HTMLarea does not work at all (ie. get a plain
> textarea) UNLESS I remove the line:
>   edit.registerPlugin(TableOperations);
> 
> Obviously I want to add in all the functionality of table
> operations found in the TableOperations javascript as
> well to the config.toolbar, but cannot do so until the 
> plugin is working
-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Formatting without commas in CForm decimal widget storage

2004-09-06 Thread Bruno Dumon
On Mon, 2004-09-06 at 08:15, Derek Hohls wrote:
> With reference to this issue:
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=109091824427273&w=2
> 
> Can anyone suggest how to override the "hard coding"
> of the decimal formatting so as to remove the comma
> when a decimal number is stored in an XML file as a
> result of binding (given that it is not displayed or entered
> that way on the form itself)?

You asked this question before, so you might want to check the archives.

Basically, define a convertor in the binding definition. Just to be
sure: IN THE BINDING DEFINITION. Because that's the point you were
missing last time.

To avoid any formatting, you can use the "plain" convertor. And pay
attention that the convertor must be in the fd namespace, not fb.

HTH

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re:

2004-08-26 Thread Bruno Dumon
On Thu, 2004-08-26 at 12:17, Superbiji wrote:
> Hi,
> 
> i'm transforming:
> ...
> 
> ...
> with:
> 
> and:
> 
> 
> resulting: 
> Could not find variable with the name of continuation
> 
> but i wanted it only be transformed by form,
> tried to use CDATA tags but not workin'
> 
> any idea how?

Use double brackets:



-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CForms and HEAD tag

2004-08-26 Thread Bruno Dumon
On Thu, 2004-08-26 at 12:01, Jorg Heymans wrote:
> Hi,
> 
> It seems that CForms do not work if there is no HEAD tag in the html. 
> Without HEAD, none of the scripting libraries get included and thus js 
> errors all over the place.
> 
> Is this a bug or a feature?

it's neither, it is just how it works.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CForms / flow question

2004-08-20 Thread Bruno Dumon
On Fri, 2004-08-20 at 15:22, Jorg Heymans wrote:
> ugh how obvious, thanks Bruno.
> 
> Actually I don't think i need continuations for my usecase, and I read 
> about the difference between sendPage() and showForm().
> 
> So i changed the showForm call to
>cocoon.sendPage("display", {"CocoonFormsInstance": form});
> 
> 
> and i'm getting a classcastexception at


this is because CocoonFormsInstance must point to the java form object,
not its javascript wrapper. Using form.form should work.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: looking for dtd or xml schemas used in cocoon

2004-08-20 Thread Bruno Dumon
On Fri, 2004-08-20 at 11:50, David Verdin wrote:
> Hi,
> 
> I'm looking for the dtds or xml schemas which are used in cocoon, 
> especially those used to define the cocoon forms generation documents 
> (defining the template, instance and definition namespaces).
> 
> I would like to use a local copy of these for validation and 
> auto-completion purpose in Jedit.
> 
> Could you tell me how I can find them ?

As far as I know, these do not exist.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CForms / flow question

2004-08-20 Thread Bruno Dumon
On Fri, 2004-08-20 at 14:35, Jorg Heymans wrote:
> Hi,
> 
> I want to continuously display a form (the submit results are in another 
> frame), saving the widgets' state in between submits.
> 
> so i do
> 
> while(true){
>var form = new Form(...);
>form.showForm("blabla");
> 
>//some call here to save the forms state to itself
> }

a form object contains the forms state, so there's no need to 'save it
to itself', simply putting the "new Form(...)" above the while should do
it.

> 
> Which method call am I missing? I am looking at userdocs/flow/api.html 
> but the Form object is not documented there. Looking at the Form.java 
> source in the form block i can't see anything related .

the javascript Form object is declared in the Form.js file, which also
contains some docs.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CForms: Bind Onload upload widget???

2004-08-19 Thread Bruno Dumon
On Thu, 2004-08-19 at 11:54, oceatoon wrote:
> Hello
> 
> I am trying to declare a Java Pacakge in the  binding javascript/onload tag 
> but I can't seem to get this to work??? 
>  is it possible to import Java Packages like in flow in the binding 
> javascript / onload tag ?
> 
> 
>  
>  var path = jxpathContext.getValue("@path");
>  var uploadFile = new java.io.File(path);
>  var uploadFilePart = 
> Packages.org.apache.commons.httpclient.methods.multipart.FilePart(path,uploadFile);

you miss a 'new' keyword here.

>   widget.setValue(uploadFilePart);

but I don't think this will work, as the value for the upload widget
should be a org.apache.cocoon.servlet.multipart.Part

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: generate XML from flowscript

2004-08-05 Thread Bruno Dumon
On Thu, 2004-08-05 at 05:55, Mark Lundquist wrote:
> On Aug 4, 2004, at 8:22 PM, Tony Edwards wrote:
> 
> Mark,
> Thanks for the pointer regarding the session object. I'll
> check it out.
> To get my document into the pipeline, I do the following:
> 
> Once I've stored the xml document in session I user the
> sessiongenerator in my pipeline to grab it and transform it:
> 
> pattern="internal/tree-menu">
> 
> value="hrcyDoc"/>
>
> src="xml2tree.xsl"/>  
> 
>
> 
> The session-attr generator refers to the
> SessionAttributeGenerator,declared thus:
>  
> name="session-attr"logger="sitemap.generator.session-attr"src="org.apache.cocoon.generation.SessionAttributeGenerator"/>
> 
> It just grabs a session attribute object which in this case is
> the xmldocument we've cobbled together from the flowscript.
> 
> Hope this helps!
> 
> That does help.  It helps a lot!  Thanks, Tony...
> 
> It's now on my to-do list to spiff up the userdoc
> forSessionAttributeGenerator :-)... there's not a whole lot there
> rightnow :-/.
> 
> It would be slightly more elegant

"slightly" is an understatement IMHO, putting data in the session which
shouldn't be there is just plain ugly.

>  to be able to passthe source data in directly to sendPage() instead
> of stashing it inthe session, but that hardly seems to justify the
> trouble of writing awhole damn generator

What you need is the module source combined with the flow-attribute
input module.

The module source is a source which gets its data from an input module.

The usage is something like:



where 'mything' is the key used in the object passed to sendPage, ie
sendPage("...", {"mykey": someObject});

The type of someObject should be either an InputStream or a String. If
you have your data retrieved in a byte array you can easily wrap it in a
ByteArrayInputStream.

OTOH, if you have your data already as a DOM-tree or an object
implementing XMLizable, you can use the XModuleSource (still in
scratchpad).

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: [CForm] javascript validation doesn't work?

2004-08-04 Thread Bruno Dumon
On Tue, 2004-08-03 at 23:08, Phil Snowdon wrote:
> Take this snippet from the samples.  Supposedly if the price is
> less than one, then it will show a validation error.  It
> doesn't.
> 
>  
> 
> 
>   var success = true;
>   var price = widget.lookupWidget("dieselprice");
>   if (price.value < 1) {
>   price.setValidationError(new
> Packages.org.apache.cocoon.forms.validation.ValidationError("It
> can not be that low!", false));
>   success = false;
>   }
>   
>   // Must return true/false
>   return success;
> 
>   

Where do you place that  element, thus as child of what
other element?

IIRC in the Cocoon 2.1.5 release widget validators belonging to
container widgets (such as a repeater or the form itself) are only
executed if all children are validated successfully. In current SVN they
are however always executed.

> 
> even simpler
> 
>   
> 
>   return false;
> 
>   

Note that you shouldn't do this, a validator returning false should
always set a validation error somewhere.

> 
> Which should always generate a validation error doesn't seems to
> either.
> 
> Is this a known issue?  There's a comment in the Form.js code
> // FIXME: Remove check for removed syntax later.
> if (this.validator != undefined) {
> throw "Forms do not support custom javascript validators
> anymore. Declare your validators in the form model file.";
> }
> 
> Does this mean that we can't use javascript validadtors anymore.
>  What does it mean by declaring your validators in the form model
> file?

No no, this has nothing to do with the validators in the form model
file.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: CForms: Validation via Java

2004-08-04 Thread Bruno Dumon
On Wed, 2004-08-04 at 03:24, Scott Yeadon wrote:
> Hello,
> 
> The CForms doco states that custom validators can be written in Java, 
> however I couldn't find any examples of this. How is the java class 
> reference set up in the fd:validation element - I tried the java element 
> (as per listener setup) however this is not recognised.

This is not yet possible, the java element hasn't been implemented yet
(though it's no big deal). You can however add java based validators to
form instances at runtime, using the addValidator() method of the
widgets.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Passing a pipeline exception\error to an error handler function?

2004-08-03 Thread Bruno Dumon
On Tue, 2004-08-03 at 16:15, Thomas Kjeldahl Nilsson wrote:
> > 
> > The exception (throwable) object is available in the objectModel, and
> > can be retrieved from it using ObjectModelHelper.getThrowable(). I don't
> > think there's a proper way to access this from flowscript, though there
> > are a variety of workarounds.
> > 
> 
> Hmm, isn't the whole object model accessible from the flowscripts?

This would suprise me.

> If not, do you have any particular suggestions\hints for workarounds?

I'm not sure what the easiest would be. One possible way is to make an
action that puts the throwable object in a request attribute.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Passing a pipeline exception\error to an error handler function?

2004-08-03 Thread Bruno Dumon
On Tue, 2004-08-03 at 14:50, Thomas Kjeldahl Nilsson wrote:
> Hello all,
> 
> I'm writing some cocoon error handling for my project, and I'm a little 
> stumped here. I've got a single error handle now, looking like this:
> 
> 
> 
> 
> 
> 
> What I'd like to do is call a flowscript function called "errorFlow"
> which does some logging and other misc. logic before sending a 
> jxtemplate page with the final, prettily formatted and translated error 
> message. I need to pass the original exception object to this flowscript 
> in order to do this. In other words I'd like something like this:
> 
> 
> 
> 
> 
> 
> 
> So the million dollar question is: How do I get and pass the original 
> exception object to the flowscript?

Using map:parameter you can only supply string values, so that wouldn't
work.

The exception (throwable) object is available in the objectModel, and
can be retrieved from it using ObjectModelHelper.getThrowable(). I don't
think there's a proper way to access this from flowscript, though there
are a variety of workarounds.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Flow : Accessing Repeater Rows value in Flow

2004-08-03 Thread Bruno Dumon
Hi oceatoon,

On Tue, 2004-08-03 at 12:56, oceatoon wrote:
> Hi Bruno 
> 
> Sorry for not being to clear, 
> Yes, I'm in the Flow 
> wid = form.getWidget();
> //"houseuploads" is my repeater
> //"path" would be the upload widget I want to retreive the content off
> wid.houseuploads.getRow(0).getValue();  (return = null)
> wid.houseuploads.getRow(0).path.getValue();  (also return = null)
> wid.houseuploads.getSize();  (return = null)
> 
> ???
> It's probably in the way I manipulate the repeater ???

I don't have enough information to give an exact answer. If you could
tell what Form.js you import and what Cocoon version you're using I
might be able to help.

> would you do this in the Java??

nope, with "Java API" I mean the native API of the widgets, which is
transparently available in javascript.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Flow : Accessing Repeater Rows value in Flow

2004-08-03 Thread Bruno Dumon
On Mon, 2004-08-02 at 17:21, oceatoon wrote:
> Hi  
> 
> I found a post "POPUALTING SELECTIONLISTS INA REPEATER FROM FLOW " where a
> similar question was asked but I can't seem to get Joergs technique(getRow
> before getting the value) to function. 
> 
> my repeater only contains an upload widget (minimum one so Row(0) allways
> exists, with add and delete). Then in my Flow, I need to retreive the value
> of the uploaded file from the widget to move it around.
> 
> wid = handleForm("masterform", "forms/", document);
> 
> //I'd like to retreive the value 
> wid.houseuploads.getRow(0).getValue();
> 
>  But this doesn't seem to work allways returns "null"

>From the wid.houseuploads notation I'd assume you're using the
javascript-wrapped variant of the widget tree, which has a different
API.

> Also, do I have run through the whole repeater or is there a size or length
> method associated to now how many entries have been submitted?

For the java API, this can be retrieved with the method getSize() of the
repeater.

I think you can find the javascript-equivalents of these in the samples.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: memory issues, SAX

2004-08-03 Thread Bruno Dumon
Lars,

are you aware that the Java VM doesn't automatically use all available
memory? IIRC on Windows by default it uses maximum 64 MB. You can
augment that by adding a parameter like -Xmx192m to the java startup
command. If you search the cocoon wiki or the internet you'll find
plenty of information on that.

As for the XSLT transforms: yes, these build a complete model of your
document in memory before doing the transform, though it's an optimized
model that should be much smaller then a typical DOM. From your earlier
non-updateable-dom problems, I'd assume that the
SourceWritingTransformer also builds a DOM in memory. By default the
serialized output of a pipeline is also completely buffered before
sending it to the client, see the explanation for "outputBufferSize" in
the default root sitemap on how to avoid that.

On Tue, 2004-08-03 at 05:25, Lars Huttar wrote:
> Dear Cocoon gurus,  [Cocoon 2.1.2, Tomcat 4.1]
> 
> We have an application where we need to generate an index
> from a large database. We seem to be running out of memory
> even in getting the unprocessed out of the database.
> 
> We initially did (sitemap pseudocode)
>   - xsp query to get rows from "Index" table of database
>   - XSLT transformation that groups together rows with certain identical fields
>   - XSLT transformation that wraps "source:write" markup around
> the XML
>   - the write-source transformer to put the XML into a file
>   - (serialize as XML)
> 
> This worked for small rowsets, but when we jump from 3700 to
> 9500 rows, it fails, with the message
> org.apache.cocoon.ProcessingException: Exception in ServerPagesGenerator.generate():
> java.lang.RuntimeException: org.apache.cocoon.ProcessingException: insertFragment: 
> fragment is
> required.
> 
> which sounds like write-source transformer is complaining that it didn't
> get its "fragment" (data to write to the file), so I supposed
> there was a failure before the write-source transformer.
> I wondered if the XSLT transformations were each building
> a DOM for the entire input. This would account for running out
> of memory.
> 
> So I tried reducing the pipeline to just obtaining the data
> and writing it to a file without grouping.
> First I tried
> 
>   - xsp query to get rows from "Index" table of database
>   - XSLT transformation that just wraps "source:write" markup around
> the XML
>   - the write-source transformer to put the XML into a file
> 
> but this failed too, and of course it has an XSLT transformation
> which is suspect -- is it building a DOM? So next I tried
> 
>   - file generator to get a file that contained a source:write
> wrapper around a cinclude statement
>   - cinclude transformer to get the data
>   - the write-source transformer to put the XML into a file
> 
> And in a separate pipeline called by the cinclude statement,
> 
>   - xsp query to get rows from "Index" table of database
> 
> But this still failed!
> 
> So now I'm wondering how it's possible to process big sets
> of data at all in Cocoon. We thought SAX meant that the XML
> data was sent piece-by-piece down the pipeline, serially,
> so you didn't run out of memory when you had a big XML data
> file. Does using XSLT mess that up by building DOMs?
> What about cinclude?
> What *can* you use to get lots of data from a database
> and process it without having to have it all in memory
> at once? Does this task need to be done outside of Cocoon?
> 
> Of course, we can split the operation up into little pieces;
> but we don't want to go through that hassle if it's avoidable.
> 
> Is it possible that I'm missing the point completely and
> there's something other than memory that's causing the
> operation to fail?
> By the way this machine has 384MB, and another I was testing
> on had 512MB. They both failed at about the same point.
> 
> Thanks for any explanations or suggestions...
> Lars

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: Error: The Saxon DOM cannot be updated

2004-08-01 Thread Bruno Dumon
On Sun, 2004-08-01 at 10:57, Lars Huttar wrote:
> > -Original Message-
> > From: Bruno Dumon [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, July 31, 2004 5:02 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Error: The Saxon DOM cannot be updated
> > 
> > 
> > > It looks like the AbstractSAXTransformer's endRecording method
> > > is trying to remove a child node from the tree, and Saxon's
> > > AbstractNode class is crying foul.
> > > 
> > > Can anyone suggest an approach for working around this problem?
> > > I suppose this is a bug in SourceWritingTransformer or
> > > AbstractSAXTransformer that has been fixed since Cocoon 2.1.2,
> > > since I'm using the same Saxon .jar file with Cocoon 2.1.5
> > > and not encountering this error.
> > 
> > I don't think there's a difference between those two cocoon 
> > versions to
> > explain it, rather the classloader which accidentely orders the jars
> > differently (there is no guarantee that the jars are read in
> > alphabetical order, this depends on the platform).
> > 
> > As the error message says, the Saxon DOM cannot be updated, 
> > meaning that
> > Saxon builds read-only DOM trees. Cocoon relies on the XSLT 
> > processor to
> > build DOM trees from SAX events. The XSLT processor that gets used for
> > this is the default one, as determined by information read from the
> > classpath resource
> > META-INF/services/javax.xml.transform.TransformerFactory.
> 
> Thanks Bruno, that is helpful.
> I move incrementally toward understanding how all this works.
> 
> The above raises the question, though, if the classloader orders
> the jars differently between Cocoon 2.1.2 and 2.1.5, both under
> the same Tomcat installation, and it does so consistently...
> that would seem to imply a significant difference between something
> in Cocoon 2.1.2 and 2.1.5. Still, I see what you're saying, if there
> is no guarantee about the order in which jars are read, then there's
> little point in trying to fix the problem by means which aren't guaranteed
> to work.

It depends on the platform, on Windows, they are always alphabetically
sorted, so if you're using Windows, there must be another explanation. 

I assume you're using the same application in both situations, thus both
with the SourceWritingTransformer in the pipeline? In that case it's
probably something in the implementation of that transformer that
changed.

> 
> > A number of solutions that come to mind:
> > * delete the directory META-INF/services from the saxon jar
> > * put xalan in the endorsed lib directory, but saxon not (thus in the
> > normal WEB-INF/lib)
> 
> This was already the case, at least, xalan was in the
> Tomcat 4.1/common/endorsed directory, but saxon was in
> Tomcat 4.1/common/lib. (There is not an endorsed directory
> in the Cocoon 2.1.2 installation I have that runs under
> Tomcat...)
> 
> I tried moving saxon7.jar to cocoon/WEB-INF/lib. 
> For Cocoon 2.1.5, this broke what had been working.
> (I.e. the transformation I described started giving the
> "Saxon DOM cannot be updated" error.)
> For Cocoon 2.1.2, it did not change the already-not-working
> behavior.

Ah, it might be that the endorsed jars override mechanism only works for
classes, not for other resources.

> 
> I then tried deleting META-INF/services from saxon7.jar
> (in Cocoon 2.1.2).
> This worked!!
> Thank you!!
> 
> I don't really understand why this works though; so here's
> hoping that this solution will continue to work.
> 
> Thanks again!
> 
> Lars

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



RE: Error: The Saxon DOM cannot be updated

2004-07-31 Thread Bruno Dumon
On Sat, 2004-07-31 at 23:37, Lars Huttar wrote:
> I've managed to get Saxon working with Cocoon 2.1.5 under Jetty,
> but for the sake of our development server it would be really nice
> to have it working under 2.1.2 and Tomcat.
> 
> The problem there, as described below, was that if I followed the
> Saxon transform with a source writer transform, an error is declared
> that says the Saxon DOM cannot be updated. This happens even
> though there is an intervening Xalan transform between the
> Saxon transform and the source writer transform:
> 
>   
> 
>  type="xslt-saxon" label="raw1"
> />
>  type="xslt">
>value="Language-name-index{3}-grouped.xml" />
> 
> 
> 
>   
> 
> I found more illuminating stuff in the error log than what I included
> in my first message on this topic. Note the lines after "Caused by":
> 
> FATAL_E (2004-07-31) 16:14.24:114   [core.xslt-processor]
> (/cvsmount/ethnologue/test-name-index/xslt-saxon/1/Tiny) Thread-10/TraxErrorHandler: 
> Error in
> TraxTransformer:
> file:/C:/Program%20Files/Apache%20Group/Tomcat%204.1/./../cocoon/./cvsmount/ethnologue/transforms/a
> dd-source-write.xsl; Line 12; Column 24;
> ; SystemID:
> file:/C:/Program%20Files/Apache%20Group/Tomcat%204.1/./../cocoon/./cvsmount/ethnologue/transforms/a
> dd-source-write.xsl; Line#: 12; Column#: 24
> javax.xml.transform.TransformerException: java.lang.UnsupportedOperationException: 
> The Saxon DOM
> cannot be updated
>   at 
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2341)
>   at 
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:682)
> ...
> ...
> Caused by: java.lang.UnsupportedOperationException: The Saxon DOM cannot be updated
>   at net.sf.saxon.om.AbstractNode.disallowUpdate(AbstractNode.java:679)
>   at net.sf.saxon.om.AbstractNode.removeChild(AbstractNode.java:566)
>   at
> org.apache.cocoon.transformation.AbstractSAXTransformer.endRecording(AbstractSAXTransformer.java:48
> 6)
>   at
> org.apache.cocoon.transformation.SourceWritingTransformer.endTransformingElement(SourceWritingTrans
> former.java:522)
>   at
> org.apache.cocoon.transformation.AbstractSAXTransformer.endElement(AbstractSAXTransformer.java:358)
>   at org.apache.cocoon.components.sax.XMLTeePipe.endElement(XMLTeePipe.java:124)
>   at 
> org.apache.xml.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:262)
>   at 
> org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:707)
>   at 
> org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336)
> 
> It looks like the AbstractSAXTransformer's endRecording method
> is trying to remove a child node from the tree, and Saxon's
> AbstractNode class is crying foul.
> 
> Can anyone suggest an approach for working around this problem?
> I suppose this is a bug in SourceWritingTransformer or
> AbstractSAXTransformer that has been fixed since Cocoon 2.1.2,
> since I'm using the same Saxon .jar file with Cocoon 2.1.5
> and not encountering this error.

I don't think there's a difference between those two cocoon versions to
explain it, rather the classloader which accidentely orders the jars
differently (there is no guarantee that the jars are read in
alphabetical order, this depends on the platform).

As the error message says, the Saxon DOM cannot be updated, meaning that
Saxon builds read-only DOM trees. Cocoon relies on the XSLT processor to
build DOM trees from SAX events. The XSLT processor that gets used for
this is the default one, as determined by information read from the
classpath resource
META-INF/services/javax.xml.transform.TransformerFactory.

A number of solutions that come to mind:
* delete the directory META-INF/services from the saxon jar
* put xalan in the endorsed lib directory, but saxon not (thus in the
normal WEB-INF/lib)

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: [CForm] No Cocoon Form found????

2004-07-31 Thread Bruno Dumon
On Fri, 2004-07-30 at 21:39, Christina wrote:
> I got this error :
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> org.xml.sax.SAXException: No Cocoon Form found.
>  
> from the follow flow: 
>var form=new Form(cocoon.parameters["form-definition"]);
>var display=cocoon.parameters["display-page"];
> ..
>cocoon.request.setAttribute("form1", form.getWidget());   
>cocoon.sendPage(display);
>  
>  it works fine if I change cocoon.sendPage(display) to
> form.showForm(display)
> But I don't get what is wrong with the cocoon.sendPage()? I set the
> form attribute!

And why did you call the attribute "form1" ?

The error you get is because the FormsTransformer couldn't find your
form. 

How the FormsTransformer searches the form is explained on this page:
http://cocoon.apache.org/2.1/userdocs/forms/templatetransformer.html

To keep it short, I think you're best of doing it like this:

cocoon.sendPage(display, {"CocoonFormsInstance": form});

You don't need to set the request attribute.

>  
> btw, would anybody be kind enough to explain what is difference
> between cocoon.sendPage and form.showForm?
> It seems sendPage is better to use as the last page of a flow because
> it helps to clean up the used resource, right? then what if showForm?

The difference is very huge.

The form.showForm function shows the form in a loop until it validates
correctly. It uses continuations, so that the form instance is also
stored server side. This is not required in general but it is required
for certain features, such as value changed events.

The sendPage function doesn't create a continuation, and simply executes
a pipeline. Using it as the last page of a flow doesn't clean up any
resources (continuations), but on the other hand doesn't allocate any
new neither. It is perfectly possible to use CForms combined with
sendPage (thus without storing the form instance server side), though
there are no examples included of this. The action sample works
stateless, so that can serve as an example.

If you have a simple form with a simple flow that is executed very
frequently, then it makes sense to avoid continuations to save
resources. Otherwise, I think you're best of using showForm.

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



  1   2   3   4   5   >