Click here to get back home

Parsing error in Amaya HTML Editor

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Parsing error in Amaya HTML Editor macruzq 01-28-2008
Posted by macruzq on January 28, 2008, 12:56 pm
Please log in for more thread options
In a web page, there is a JS script. Comments start with // and I
usually start any comment or remark in any language with -- ( two
dashes).
The case is when Amaya opens a .html file that has the following:

. . . . . . . . . .
<script type="text/javascript" language="JavaScript">
        <!-- ;
        function anyfunction(arg1,arg2,arg3)
        {
        //-- mask out, do not execute ;
        //-- alert("Image to set:"+button_image);
        document.getElementById(button_id).src=button_image;
        document.URL=url_dest;
        }
        //-->
</script>
. . . . . . . . . .

Amaya reports parsing error:

line nn, char n: not well-formed (invalid token)

        //-- mask out, do not execute ;
[ ^ highlited]

It shows same message even with "// --" (space after two slashes).
Only with "// - - " (space after first dash) parsing error message
stops from showing up.
I think it should not give any message, because it is inside a
comment. Should it?

Thanks in advance for any suggestions.

Marco

--------------------------------------
Freedom is not a permission for chaos.

Posted by Harlan Messinger on January 28, 2008, 1:20 pm
Please log in for more thread options
macruzq wrote:
> In a web page, there is a JS script. Comments start with // and I
> usually start any comment or remark in any language with -- ( two
> dashes).
> The case is when Amaya opens a .html file that has the following:
>
> . . . . . . . . . .
> <script type="text/javascript" language="JavaScript">
>         <!-- ;
>         function anyfunction(arg1,arg2,arg3)
>         {
>         //-- mask out, do not execute ;
>         //-- alert("Image to set:"+button_image);
>         document.getElementById(button_id).src=button_image;
>         document.URL=url_dest;
>         }
>         //-->
> </script>
> . . . . . . . . . .
>
> Amaya reports parsing error:
>
> line nn, char n: not well-formed (invalid token)
>
>         //-- mask out, do not execute ;
> [ ^ highlited]
>
> It shows same message even with "// --" (space after two slashes).
> Only with "// - - " (space after first dash) parsing error message
> stops from showing up.
> I think it should not give any message, because it is inside a
> comment. Should it?

It isn't inside the comment--it terminates the comment. See

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4

and, for more info,

http://htmlhelp.com/reference/wilbur/misc/comment.html

(though I discovered the IE6 and Firefox both fail to permit whitespace
between the final -- and the closing >. Actually, in that case, I'm
observing that even in the source code view in each browser, the entire
comments and everything that follows is missing. Does anyone know what
that is???)

But unless you have specific reason to think you're still writing for
browsers that don't recognize the SCRIPT tag, there's no longer any
point to this exercise. The code

> <script type="text/javascript" language="JavaScript">
>         function anyfunction(arg1,arg2,arg3)
>         {
>         // mask out, do not execute ;
>         // alert("Image to set:"+button_image);
>         document.getElementById(button_id).src=button_image;
>         document.URL=url_dest;
>         }
> </script>

is adequate.

Posted by macruzq on January 29, 2008, 12:29 pm
Please log in for more thread options
On Jan 28, 12:20 pm, Harlan Messinger
> macruzq wrote:
> > In a web page, there is a JS script. Comments start with // and I
> > usually start any comment or remark in any language with -- ( two
> > dashes).
> > The case is when Amaya opens a .html file that has the following:
>
> > . . . . . . . . . .
> > <script type="text/javascript" language="JavaScript">
> > <!-- ;
> > function anyfunction(arg1,arg2,arg3)
> > {
> > //-- mask out, do not execute ;
> > //-- alert("Image to set:"+button_image);
> > document.getElementById(button_id).src=button_image;
> > document.URL=url_dest;
> > }
> > //-->
> > </script>
> > . . . . . . . . . .
>
> > Amaya reports parsing error:
>
> > line nn, char n: not well-formed (invalid token)
>
> > //-- mask out, do not execute ;
> > [ ^ highlited]
>
> > It shows same message even with "// --" (space after two slashes).
> > Only with "// - - " (space after first dash) parsing error message
> > stops from showing up.
> > I think it should not give any message, because it is inside a
> > comment. Should it?
>
> It isn't inside the comment--it terminates the comment. See
>
Thank you for the hint.

> http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4
>
> and, for more info,
>
> http://htmlhelp.com/reference/wilbur/misc/comment.html
>
> (though I discovered the IE6 and Firefox both fail to permit whitespace
> between the final -- and the closing >. Actually, in that case, I'm
> observing that even in the source code view in each browser, the entire
> comments and everything that follows is missing. Does anyone know what
> that is???)
>
> But unless you have specific reason to think you're still writing for
> browsers that don't recognize the SCRIPT tag, there's no longer any
> point to this exercise. The code
>
> > <script type="text/javascript" language="JavaScript">
> > function anyfunction(arg1,arg2,arg3)
> > {
> > // mask out, do not execute ;
> > // alert("Image to set:"+button_image);
> > document.getElementById(button_id).src=button_image;
> > document.URL=url_dest;
> > }
> > </script>
>
> is adequate.

Of course it is adequate, but I have been doing this for several
years. Thanks anyway.

Marco

Posted by Harlan Messinger on January 29, 2008, 12:50 pm
Please log in for more thread options
macruzq wrote:
> On Jan 28, 12:20 pm, Harlan Messinger
>> macruzq wrote:
>>> In a web page, there is a JS script. Comments start with // and I
>>> usually start any comment or remark in any language with -- ( two
>>> dashes).
>>> The case is when Amaya opens a .html file that has the following:
>>> . . . . . . . . . .
>>> <script type="text/javascript" language="JavaScript">
>>> <!-- ;
>>> function anyfunction(arg1,arg2,arg3)
>>> {
>>> //-- mask out, do not execute ;
>>> //-- alert("Image to set:"+button_image);
>>> document.getElementById(button_id).src=button_image;
>>> document.URL=url_dest;
>>> }
>>> //-->
>>> </script>
>>> . . . . . . . . . .
>>> Amaya reports parsing error:
>>> line nn, char n: not well-formed (invalid token)
>>> //-- mask out, do not execute ;
>>> [ ^ highlited]
>>> It shows same message even with "// --" (space after two slashes).
>>> Only with "// - - " (space after first dash) parsing error message
>>> stops from showing up.
>>> I think it should not give any message, because it is inside a
>>> comment. Should it?
>> It isn't inside the comment--it terminates the comment. See
>>
> Thank you for the hint.
>
>> http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4
>>
>> and, for more info,
>>
>> http://htmlhelp.com/reference/wilbur/misc/comment.html
>>
>> (though I discovered the IE6 and Firefox both fail to permit whitespace
>> between the final -- and the closing >. Actually, in that case, I'm
>> observing that even in the source code view in each browser, the entire
>> comments and everything that follows is missing. Does anyone know what
>> that is???)
>>
>> But unless you have specific reason to think you're still writing for
>> browsers that don't recognize the SCRIPT tag, there's no longer any
>> point to this exercise. The code
>>
>> > <script type="text/javascript" language="JavaScript">
>> > function anyfunction(arg1,arg2,arg3)
>> > {
>> > // mask out, do not execute ;
>> > // alert("Image to set:"+button_image);
>> > document.getElementById(button_id).src=button_image;
>> > document.URL=url_dest;
>> > }
>> > </script>
>>
>> is adequate.
>
> Of course it is adequate, but I have been doing this for several
> years. Thanks anyway.

I didn't mean you should get rid of the hyphens in front of your
Javascript comments, even though I did in my example. But why would you
keep wrapping the old script in an HTML comment when all it does is
limit your flexibility to format your Javascript as you want to?

Posted by VK on January 31, 2008, 12:33 pm
Please log in for more thread options
> In a web page, there is a JS script. Comments start with // and I
> usually start any comment or remark in any language with -- ( two
> dashes).
> The case is when Amaya opens a .html file that has the following:
>
> . . . . . . . . . .
> <script type="text/javascript" language="JavaScript">
> <!-- ;
> function anyfunction(arg1,arg2,arg3)
> {
> //-- mask out, do not execute ;
> //-- alert("Image to set:"+button_image);
> document.getElementById(button_id).src=button_image;
> document.URL=url_dest;
> }
> //-->
> </script>
> . . . . . . . . . .
>
> Amaya reports parsing error:
>
> line nn, char n: not well-formed (invalid token)
>
> //-- mask out, do not execute ;
> [ ^ highlited]
>
> It shows same message even with "// --" (space after two slashes).
> Only with "// - - " (space after first dash) parsing error message
> stops from showing up.
> I think it should not give any message, because it is inside a
> comment. Should it?
>
> Thanks in advance for any suggestions.

To see your problem, make a simple XML file like

<?xml version="1.0"?>
<demo>
<script>
<!-- ;
function anyfunction(arg1,arg2,arg3)
{
//-- mask out, do not execute ;
//-- alert("Image to set:"+button_image);
document.getElementById(button_id).src=button_image;
document.URL=url_dest;
}
//-->
</script>
</demo>

Save it with .xml extension and try to open in any browser supporting
XML: it will properly report "document is not well-formed, cannot
display" or similar error message.

The bad news is that in order to have documents able to be processed
in a variable environment (under HTML as well as under XML rules) you
have to change your coding habits.

The good news is that these changes are minimal and affecting only the
outer comment formatting. This will work well everywhere:

<?xml version="1.0"?>
<demo>
<script>//<![CDATA[
function anyfunction(arg1,arg2,arg3)
{
//-- mask out, do not execute ;
//-- alert("Image to set:"+button_image);
document.getElementById(button_id).src=button_image;
document.URL=url_dest;
}
//]]></script>
</demo>

The modern combo comment format for HTML/XML variable parsing is
explained in great details in my post here:http://groups.google.com/
group/comp.lang.javascript/msg/3bc6c90a43d9910f




Similar ThreadsPosted
Does anyone use Amaya? [was: Amaya Make Book sample or example?] March 17, 2005, 10:42 am
Best tool to convert html into XHTML for XML parsing? March 17, 2005, 1:15 am
HTML editor vs. WYSIWYG editor, CSS May 10, 2006, 1:41 am
Amaya Make Book sample or example? March 7, 2005, 5:35 am
css parsing order May 20, 2006, 8:11 pm
Parsing linefeeds correctly December 1, 2004, 7:53 pm
content negotiation and parsing page contents February 6, 2006, 11:43 am
error in c program for cgi ng.html February 10, 2006, 10:22 am
Error when validating HTML pages May 2, 2005, 7:28 pm
Error al abrir excel file en html January 23, 2006, 10:01 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap