I have not tried not the example at 
http://jakarta.apache.org/tapestry/3.0.4/doc/ComponentReference/Script.html


But I think your error is caused by 
hava an comment before 
<?xml version="1.0" encoding="UTF-8"?>

in FormFocus.script.

You could try deleting the comment before it and see
what happens.

Shing


--- Mark Stang <[EMAIL PROTECTED]> wrote:

> I copied this exactly from the Tapestry web site:
> 
>
http://jakarta.apache.org/tapestry/3.0.4/doc/ComponentReference/Script.html
> 
> My script looks like:
> <!-- Sets the focus to the first form element which
> is not hidden and not disabled. --> 
> <!-- /com/mycorp/scripts/FormFocus.script --> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE script PUBLIC
> 
>       "-//Apache Software Foundation//Tapestry Script
> Specification 3.0//EN"
> 
> 
>
"http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd";>
> 
> <script>
>   <body>
> <![CDATA[ 
> function setFocus() {
>     if (document.forms[0]) {
>         for (i = 0; i <
> document.forms[0].elements.length; i++) {
>             if (document.forms[0].elements[i].type
> != "hidden" &&
>                
> document.forms[0].elements[i].disabled != true) {
> 
>                
> document.forms[0].elements[i].focus();
>                 return;
>             }
>         }
>     } 
> }
> ]]>
>   </body>
>   <initialization>
>     setFocus();
>   </initialization>
> </script>
> 
> Has anyone tested this or am I doing something
> wrong?
> 
> You may continue by restarting the session.
> 
> org.apache.tapestry.ApplicationRuntimeException
> Unable to parse script context:/images/FormFocus.js.
> component: 
>
[EMAIL PROTECTED]/$Script]
> location:     context:/images/FormFocus.js, line 3,
> column 6
>  
> org.apache.tapestry.ApplicationRuntimeException
> Unable to parse script context:/images/FormFocus.js.
> location:     context:/images/FormFocus.js, line 3,
> column 6
>  
> org.apache.tapestry.util.xml.DocumentParseException
> Unable to parse
>
file:/home/mstang/projects/ping/devel/pingfederate/server/default/tmp/deploy/tmp11221pingfederate.war/images/FormFocus.js:
> The processing instruction target matching
> "[xX][mM][lL]" is not allowed.
> documentLocation:     context:/images/FormFocus.js
> location:     context:/images/FormFocus.js, line 3,
> column 6
>  
> org.xml.sax.SAXParseException
> The processing instruction target matching
> "[xX][mM][lL]" is not allowed.
> columnNumber:         6
> lineNumber:   3
> Stack Trace:
> 
>     *
>
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)
>     *
>
org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown
> Source)
>     *
>
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
>     *
>
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
> 
> 
> Thanks,
> 
> Mark
> 
> -----Original Message-----
> From: Jesse Kuhnert [mailto:[EMAIL PROTECTED]
> Sent: Mon 6/19/2006 4:55 PM
> To: Tapestry users
> Subject: Re: Suppressing page response - simply
> override the output stream manually
>  
> I think the script referenced can't just be a
> regular js file (as that would
> imply an @Include sort of component, not a @Script).
> 
> You probably need to wrap it in xml elements as
> defined here
>
http://tapestry.apache.org/tapestry4/UsersGuide/script.html.
> 
> You can also focus form fields (in 4 at least) by
> playing with the focus
> parameters of the @Form or individual form
> components.
> 
> On 6/19/06, Mark Stang <[EMAIL PROTECTED]>
> wrote:
> >
> > I am trying to use the form focus example in the
> documentation and I get:
> >
> > An exception has occurred.
> >
> > You may continue by restarting the session.
> >
> > org.apache.tapestry.ApplicationRuntimeException
> > Unable to parse script
> context:/images/FormFocus.js.
> > component:     
> [EMAIL PROTECTED]
> > [login/$Script]
> > location:       context:/images/FormFocus.js, line
> 1, column 1
> >
> > org.apache.tapestry.ApplicationRuntimeException
> > Unable to parse script
> context:/images/FormFocus.js.
> > location:       context:/images/FormFocus.js, line
> 1, column 1
> >
> >
> org.apache.tapestry.util.xml.DocumentParseException
> > Unable to parse
> >
>
file:/home/mstang/projects/ping/devel/pingfederate/server/default/tmp/deploy/tmp2276pingfederate.war/images/FormFocus.js:
> > Content is not allowed in prolog.
> > documentLocation:      
> context:/images/FormFocus.js
> > location:       context:/images/FormFocus.js, line
> 1, column 1
> >
> > org.xml.sax.SAXParseException
> > Content is not allowed in prolog.
> > columnNumber:   1
> > lineNumber:     1
> > Stack Trace:
> >
> >     *
>
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> > Source)
> >     *
>
org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown
> > Source)
> >     *
>
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
> >     *
>
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> Source)
> >     *
>
org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown
> Source)
> >     *
> >
>
org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown
> > Source)
> >     *
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> > Source)
> >     *
>
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
> >     *
>
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
> >     *
> org.apache.xerces.parsers.XMLParser.parse(Unknown
> Source)
> >     *
>
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> Source)
> >     * javax.xml.parsers.SAXParser.parse(Unknown
> Source)
> >     *
>
org.apache.tapestry.util.xml.RuleDirectedParser.parse(
> > RuleDirectedParser.java:173)
> >     *
>
org.apache.tapestry.util.xml.RuleDirectedParser.parse(
> > RuleDirectedParser.java:127)
> >     *
>
org.apache.tapestry.script.ScriptParser.parse(ScriptParser.java:115)
> >     *
>
org.apache.tapestry.engine.DefaultScriptSource.parse(
> 
=== message truncated ===

Home page :
  http://uk.geocities.com/matmsh/index.html


                
___________________________________________________________ 
The all-new Yahoo! Mail goes wherever you go - free your email address from 
your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html

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

Reply via email to