[EMAIL PROTECTED] wrote:

>Andrew,
>
>I don't know what's wrong, but here's a few things to try:
>  
>
Thanks!  Actually, I didn't mean to send, this and thought I hit stop. 
 I discovered my
problem was actually some invisible character had snuck its way into the 
<?xml version="1.0"?>
processing instruction.

But I'm glad I did send it!

>1) <map:actions>
>    <map:action name="HelloAction"
>          src="HelloAction"
>        logger="webapp.xmlform"/>
>    <map:action name="HelloAction" src="HelloAction"
>        logger="webapp.xmlform"/>
>  </map:actions>
>
>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:
>
Yes, I must have added it twice..  

><map:actions>
>      <map:action name="HelloAction" src
>="org.apache.cocoon.samples.xmlform.HelloAction"  logger="webapp.xmlform"/>
></map:actions>
>(you will need to change the src so as to match where you compile your
>HelloAction.java)
>
>2) <!-- A trivial example - Hello XMLForm -->
>   <map:match pattern="hello.html">
>        <map:act type="HelloAction">
>
>          <!-- XMLForm parameters for the HowtoWizardAction -->
>          <map:parameter name="xmlform-id" value="hello-form"/>
>          <map:parameter name="xmlform-scope" value="session"/>
>          <map:parameter name="xmlform-model" value="HelloBean"/>
>
>          <!-- Content transformation logic -->
>          <map:generate src="content/form/{page}.xml"/>
>          <map:transform type="xmlform" label="xml"/>
>          <map:transform src="stylesheets/form2html.xsl"/> <!-- ripped 
>off from
>the wizard sample, did try commenting out -->
>          <map:transform type="xmlform" label="xml"/>
>          <map:transform src="stylesheets/form2html.xsl"/>
>          <map:transform
>src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>          <map:serialize type="html"/>
>        </map:act>
>   </map:match>
>
>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.
>  
>
I'm not I just renamed the wizard stylesheet.

>3) I would do this:
>    <map:match pattern="hello.html">
>        <map:act type="HelloAction">
>
>          <!-- XMLForm parameters for the HowtoWizardAction -->
>          <map:parameter name="xmlform-id" value="hello-form"/>
>          <map:parameter name="xmlform-scope" value="session"/>
>          <map:parameter name="xmlform-model" value="HelloBean"/>
>
>          <!-- Content transformation logic -->
>          <map:generate src="content/form/{page}.xml"/>
>          <map:transform type="xmlform" label="xml"/>
>        <map:transform scr=="stylesheets/wizard2html.xsl"/>
>          <map:transform src="stylesheets/form2html.xsl"/>
>          <map:serialize type="html"/>
>       </map:act>
>   </map:match>
>
>If this doesn't work, comment out the three transformers, change <map:serialize
>type="html"> to <map:serialize type="xml"/>, 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.
>
You can also look at it in mozilla 1.0 and just right-click and view 
source. ;-)

>  
>
>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.
>  
>
I appreciate your help!  Thanks!

-Andy

>--Michael
>
>
>
>                                                                                      
>                  
>                      "Andrew C.                                                      
>                  
>                      Oliver"                  To:       [EMAIL PROTECTED]    
>                  
>                      <acoliver@apache.        cc:                                    
>                  
>                      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:
>
> <map:components>
>  <map:actions>
>    <map:action name="HelloAction"
>          src="HelloAction"
>        logger="webapp.xmlform"/>
>    <map:action name="HelloAction" src="HelloAction"
>        logger="webapp.xmlform"/>
>  </map:actions>
>  <map:generators default="file">
>    <map:generator label="content,data"
>logger="sitemap.generator.serverpages" n
>ame="serverpages" pool-grow="2" pool-max="32" pool-min="4"
>src="org.apache.cocoo
>n.generation.ServerPagesGenerator"/>
>
>  </map:generators>
>  <map:transformers default="xslt">
>   <map:transformer logger="sitemap.transformer.sql" name="sql"
>src="org.apache.
>cocoon.transformation.SQLTransformer"/>
>   <map:transformer name="xmlform"
>src="org.apache.cocoon.transformation.XMLForm
>Transformer" logger="webapp.xmlform"/>
>  </map:transformers>
>  <map:readers default="resource"/>
>  </map:transformers>
>  <map:readers default="resource"/>
>  <map:serializers default="html"/>
>  <map:matchers default="wildcard"/>
>  <map:selectors default="browser"/>
> </map:components>
>
>....
>
>   <!-- A trivial example - Hello XMLForm -->
>   <map:match pattern="hello.html">
>        <map:act type="HelloAction">
>
>          <!-- XMLForm parameters for the HowtoWizardAction -->
>          <map:parameter name="xmlform-id" value="hello-form"/>
>          <map:parameter name="xmlform-scope" value="session"/>
>          <map:parameter name="xmlform-model" value="HelloBean"/>
>
>          <!-- Content transformation logic -->
>          <map:generate src="content/form/{page}.xml"/>
>          <map:transform type="xmlform" label="xml"/>
>          <map:transform src="stylesheets/form2html.xsl"/> <!-- ripped 
>off from
>the wizard sample, did try commenting out -->
>          <map:transform type="xmlform" label="xml"/>
>          <map:transform src="stylesheets/form2html.xsl"/>
>          <map:transform
>src="context://stylesheets/xmlform/xmlform2html.xsl"/>
>          <map:serialize type="html"/>
>        </map:act>
>   </map:match>
>
>...
>
>here is my xml form
>
>        <?xml version="1.0" ?>
>
>        <document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002";>
>
>
>          <xf:form id="hello-form" view="hello" action="hello.html">
>
>            <xf:caption>Hello</xf:caption>
>
>            <error>
>              <xf:violations class="error"/>
>            </error>
>
>            <xf:textbox ref="/lastName">
>                <xf:caption>Last Name</xf:caption>
>                <xf:violations class="error"/>
>            </xf:textbox>
>
>            <xf:textbox ref="/firstName">
>                <xf:caption>First Name</xf:caption>
>                <xf:violations class="error"/>
>            </xf:textbox>
>
>            <xf:submit id="next" class="button">
>              <xf:caption>Next</xf:caption>
>            </xf:submit>
>
>          </xf:form>
>
>        </document>
>
>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, [EMAIL PROTECTED]
> */
>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
>   * <pre>if getCommand().equals("Cancel") return page("input");</pre>
>   *
>   */
>  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: [EMAIL PROTECTED]
>For additional commands, email: [EMAIL PROTECTED]
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, email: [EMAIL PROTECTED]
>
>
>  
>




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

Reply via email to