using applet marvin in a website causes error with molfile

User 247a2c5018

29-07-2009 10:48:54

I use marvin view for editing a result after substructure search  but i have on error.


The structure are not represented; I send you a piece of source html


<tr>
                                    <td align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><script LANGUAGE="JavaScript1.1" SRC="marvin/marvin.js"></script>
                                    <script LANGUAGE="JavaScript1.1">
                                    <!--
                                    // marvin_jvm = "builtin"; // "builtin" or "plugin"
                                    mview_begin("marvin/", 250, 120); //arguments: codebase, width, height
                                    // you could also use the mview_begin("../../..", 200, 200, true ); function call to load the applet without splash screen.
                                    mview_param("mol", "
      -IDBS-   042320091015

  5  4  0  0  0  0  0  0  0  0999 V2000
    3.1000   -5.5000    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    2.3833   -5.9167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.9625   -5.9167    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    0.2500   -6.3375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.6750   -6.3292    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  2  1  3  0     0  0
  3  5  1  0     0  0
  4  3  2  0     0  0
  5  2  1  0     0  0
M  END
");
                                    mview_param("molbg", "#ffffff");
                                    mview_end();
                                    //-->
                                    </script></font></td>
                                  </tr>
                                 
                                                    
                                  <tr>
                                    <td align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><script LANGUAGE="JavaScript1.1" SRC="marvin/marvin.js"></script>
                                    <script LANGUAGE="JavaScript1.1">
                                    <!--
                                    // marvin_jvm = "builtin"; // "builtin" or "plugin"
                                    mview_begin("marvin/", 250, 120); //arguments: codebase, width, height
                                    // you could also use the mview_begin("../../..", 200, 200, true ); function call to load the applet without splash screen.
                                    mview_param("mol", "
      -IDBS-   042320091235

  5  4  0  0  0  0  0  0  0  0999 V2000
   -0.9083   -2.2125    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   -1.6208   -1.8000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.9083   -3.0375    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   -1.6208   -0.9750    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -2.3333   -2.2125    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  2  1  2  0     0  0
  3  1  1  0     0  0
  4  2  1  0     0  0
  5  2  1  0     0  0
M  END
");
                                    mview_param("molbg", "#ffffff");
                                    mview_end();
                                    //-->
                                    </script></font></td>
                                  </tr>


 


 


 


If I replace the molfile by a file like test.mol, the structure are well represented.


 

ChemAxon 7c2d26e5cf

29-07-2009 12:57:54

To be able to check your code, please attach the (relevant part) of the source in a separate file. When you insert source into the forum post, the extra spaces may be cut.

User 247a2c5018

29-07-2009 13:37:20

I attach the file

ChemAxon 7c2d26e5cf

29-07-2009 14:53:45

Thanks for the attached source.


The problem is that Javascript does not accept multiline text among quotes. Escape line breaks with \n characters.


mview_param("mol", "\n"+
"      -IDBS-   042320091015\n"+
"\n"+
"  5  4  0  0  0  0  0  0  0  0999 V2000\n"+
"    3.1000   -5.5000    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\n"+
"    2.3833   -5.9167    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n"+
"    0.9625   -5.9167    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0\n"+
"    0.2500   -6.3375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n"+
"    1.6750   -6.3292    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n"+
"  2  1  3  0     0  0\n"+
"  3  5  1  0     0  0\n"+
"  4  3  2  0     0  0\n"+
"  5  2  1  0     0  0\n"+
"M  END\n");