Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 36745 invoked by uid 500); 13 Jun 2002 00:05:59 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 36734 invoked from network); 13 Jun 2002 00:05:59 -0000 Subject: Re: XMLForm hello world in the works To: cocoon-dev@xml.apache.org X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 Message-ID: From: mratliff@collegenet.com Date: Wed, 12 Jun 2002 17:18:16 -0700 X-MIMETrack: Serialize by Router on pdx1/UAI(Release 5.0.9 |November 16, 2001) at 06/12/2002 05:17:39 PM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Sorry, that last transform for the pipeline given in 3) should be: mratliff@collegen et.com To: cocoon-dev@xml.apache.org cc: 06/12/02 05:13 PM Subject: Re: XMLForm hello world in the works Please respond to cocoon-dev Andrew, I don't know what's wrong, but here's a few things to try: 1) I don't get this. Why are you declaring two identical actions? Can't see why it would hurt, but can't see how it helps either... I would do something like this: (you will need to change the src so as to match where you compile your HelloAction.java) 2) Don't understand this, either. Why are you repeating the "xmlform" transformation? This transformation "expects" to be invoked right after the generation step and before either of the xslt transformations. Invoking it after an xslt transformation can't be good. But again, I can't say for sure this is your problem. 3) I would do this: If this doesn't work, comment out the three transformers, change to , and look at the results in MSIE 5.x (where you can see the raw XML that is produced). Check logs. If no errors, uncomment the next transformer and repeat. This should pinpoint the error to the action, generator, or transformer. It will also let you see exactly what is happening in each step. I skimmed your code; nothing jumped out at me. Do these things and post another message to dev group, and I'll try to be more helpful. --Michael "Andrew C. Oliver" To: cocoon-dev@xml.apache.org Subject: XMLForm hello world in the works 06/12/02 04:03 PM Please respond to cocoon-dev Hi All, I'm trying to create a HelloXMLForm example and I'm getting this: /The processing instruction target matching "[xX][mM][lL]" is not allowed./ More precisely: /org.apache.cocoon.ProcessingException: Failed to execute pipeline.: org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed./ (to see the full error you can go to http://www.superlinksoftware.com/cocoon/samples/bringmethis/hello.html) any thoughts on what this means? relevent sitemap entries: .... ... here is my xml form Hello Last Name First Name Next here is my action // Java classes import java.util.Map; import java.util.HashMap; import java.util.SortedSet; import java.util.Iterator; import java.util.Properties; import java.io.InputStream; import java.io.FileInputStream; import java.io.File; // XML classes // import javax.xml.transform.stream.StreamSource; // import javax.xml.transform.TransformerException; // import org.xml.sax.InputSource; // import org.w3c.dom.Node; // import org.w3c.dom.NodeList; // Framework classes import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.excalibur.pool.Poolable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; // Cocoon classes import org.apache.cocoon.environment.Redirector; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.acting.*; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Session; import org.apache.cocoon.environment.Context; // Schematron classes //import org.apache.cocoon.validation.SchemaFactory; //import org.apache.cocoon.validation.Schema; //import org.apache.cocoon.validation.Validator; //import org.apache.cocoon.validation.Violation; // Cocoon XMLForm import org.apache.cocoon.acting.AbstractXMLFormAction; import org.apache.cocoon.components.xmlform.Form; import org.apache.cocoon.components.xmlform.FormListener; /** * This action demonstrates * a relatively complex form handling scenario. * * @author Heidi Brannan, heidi@wkwyw.net */ public class HelloAction extends AbstractXMLFormAction implements FormListener { // different form views // participating in the wizard final String VIEW_HELLO = "hello"; final String VIEW_SAYHELLO = "sayhello"; // action commands used in the wizard final String CMD_START = "start"; final String CMD_NEXT = "next"; final String CMD_PREV = "prev"; /** * The first callback method which is called * when an action is invoked. * * It is called before population. * * * @return null if the Action is prepared to continue. * an objectModel map which will be immediately returned by the action. * * This method is a good place to handle buttons with Cancel * kind of semantics. For example *
if getCommand().equals("Cancel") return page("input");
* */ protected Map prepare() { if ( getCommand() == null ) { return page( VIEW_HELLO ); } else if ( getCommand().equals( CMD_START ) ) { // reset state by removing old form // if one exists Form.remove( getObjectModel(), getFormId() ); getForm().addFormListener( this ); return page( VIEW_HELLO ); } // get ready for action // if not ready return page("whereNext"); return null; } /** * Invoked after form population * * Semanticly similar to Struts Action.perform() * * Take appropriate action based on the command * */ public Map perform () { // get the actual model which this Form encapsulates // and apply additional buziness logic to the model HelloBean jBean = (HelloBean) getForm().getModel(); //jBean.incrementCount(); // set the page control flow parameter // according to the validation result if ( getCommand().equals( CMD_NEXT ) && getForm().getViolations () != null ) { // errors, back to the same page return page( getFormView() ); } else { // validation passed // continue with control flow // clear validation left overs in case the user // did not press the Next button getForm().clearViolations(); // get the user submitted command (through a submit button) String command = getCommand(); // get the form view which was submitted String formView = getFormView(); // apply control flow rules if ( formView.equals ( VIEW_HELLO ) ) { if ( command.equals( CMD_NEXT ) ) { return page( VIEW_SAYHELLO ); } } else if ( formView.equals ( VIEW_SAYHELLO ) ) { if ( command.equals( CMD_NEXT ) ) { return page( VIEW_HELLO ); } if ( command.equals( CMD_PREV ) ) { return page( VIEW_HELLO ); } } } // should never reach this statement return page( VIEW_HELLO ); } /** * * FormListener callback * called in the beginning Form.populate() * before population starts. * * This is the place to handle unchecked checkboxes. * */ public void reset( Form form ) { } /** * FormListener callback * * Invoked during Form.populate(); * * It is invoked before a request parameter is mapped to * an attribute of the form model. * * It is appropriate to use this method for filtering * custom request parameters which do not reference * the model. * * Another appropriate use of this method is for graceful filtering of invalid * values, in case that knowledge of the system state or * other circumstainces make the standard validation * insufficient. For example if a registering user choses a username which * is already taken - the check requires database transaction, which is * beyond the scope of document validating schemas. * Of course customized Validators can be implemented to do * this kind of domain specific validation * instead of using this method. * * * @return false if the request parameter should not be filtered. * true otherwise. */ public boolean filterRequestParameter (Form form, String parameterName) { // TBD return false; } public String getFile( String FileName ) { try { final String FILE_PREFIX = "file:"; String path = getSourceResolver().resolve(FileName).getSystemId(); if(path.startsWith(FILE_PREFIX)) path = path.substring(FILE_PREFIX.length()); return path; } catch(Exception e) { getLogger().error("could not read mapping file",e); return null; } } //private Validator validator_ = null; private boolean initialized_ = false; } And here is my bean: import java.util.Set; import java.util.HashSet; import java.util.List; import java.util.ArrayList; /** * * A sample JavaBean used as a Form model. * */ public class HelloBean { private String firstname = "John"; private String lastname = "Doe"; public HelloBean () { } public String getFirstName() { return firstname; } public void setFirstName(String newFirstName) { firstname = newFirstName; } public String getLastName() { return lastname; } public void setLastName(String newLastName) { lastname = newLastName; } } -Andy --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org