You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Sheldon Glickler <sh...@thevillages.net> on 2008/11/13 19:38:10 UTC

invalid flag after regular expression

First of all, thank you to all who have helped me get this far.

I have an xsl and can generate the appropriate xml from the data in the 
database.  When I run the fop command manually, it generates a very nice 
looking pdf with no errors (other than a font message).

I use php code to generate the xml file.  This php is invoked via an 
AJAX call.  After the xml file is generated I use the php command

exec(the_command_string_for_running_the_php);

When I do that, I get the error message "invalid flag after regular 
expression".  I posted to the php and javascript newsgroups, but they 
said that it was probably from the fop.  I also googled for the message 
with very little luck and I search for the message in all my code 
without finding it.

Does anyone have a suggestion?  As a last resort I will set up a cron 
job to run it if the xml file is there and the pdf is not there. 
However, I would much rather this happen synchronously.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: invalid flag after regular expression

Posted by Sheldon Glickler <sh...@thevillages.net>.
Andreas Delmelle wrote:
> On 13 Nov 2008, at 20:43, Sheldon Glickler wrote:
> 
> Hi
> 
>> <snip />
>> Now I am left with wondering why the exec command didn't create the 
>> pdf -- but that is a different problem.
> 
> This needs some digging in the server logs, if I guess correctly...
> (if there is a server log somewhere, where the output from the exec() 
> command is dumped into?)

I solved it.  I added " > /dev/null" to the command.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: invalid flag after regular expression

Posted by Andreas Delmelle <an...@telenet.be>.
On 13 Nov 2008, at 20:43, Sheldon Glickler wrote:

Hi

> <snip />
> Now I am left with wondering why the exec command didn't create the  
> pdf -- but that is a different problem.

This needs some digging in the server logs, if I guess correctly...
(if there is a server log somewhere, where the output from the exec()  
command is dumped into?)


HTH!

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: invalid flag after regular expression

Posted by Sheldon Glickler <sh...@thevillages.net>.
Andreas Delmelle wrote:
> On 13 Nov 2008, at 19:38, Sheldon Glickler wrote:
> 
> Hi
> 
> <snip />
>> I use php code to generate the xml file.  This php is invoked via an 
>> AJAX call.  After the xml file is generated I use the php command
>>
>> exec(the_command_string_for_running_the_php);
> 
> How is the setup precisely? Since mixing client- and server-side 
> scripting is always a bit tricky, I just want to make sure I understand 
> correctly
> 
> If all is well, I'm guessing it looks a little like:
> 1° launch asynchronous request and return (client-side, Javascript)
> 2° generate the XML and send a response, indicating that it's ready to 
> be converted (server-side, PHP)
> 3° handle the response, by sending a second request, and return 
> (client-side, Javascript)
> 4° handle the second request, and send a response when complete 
> (server-side, PHP; your 'exec();' statement)
> 5° handle the new response, which could be something like setting the 
> 'src' attribute of an IFRAME to the location where the PDF was generated 
> (client-side, Javascript)

Not nearly that complicated.  There is only one AJAX call.

The browser is displaying a particular page (which was obtained via the 
AJAX route and filling in the template).  On that page are various 
fields, one of which is a button to create the pdf.  Clicking that 
button invokes a javascript that picks a few values off the page and 
does the AJAX call.  The php script invoked does the following:

1 - gather data from the database
2 - build the xml file, writing it in a particular folder
3 - invokes an exec command for the fop to build the pdf

It then returns, changing an innerHTML of a tag to indicate that the pdf 
file is in place -- but NOT do display the pdf.

All the work is done server side.  The exec call is synchronous with, 
and immediately after, the successful writing of the xml file.

> 
> Where step 3° (5° resp.) corresponds to the AJAX onreadystatechange() 
> handler attached to the request sent in step 1° (3° resp.).
> 
>> When I do that, I get the error message "invalid flag after regular 
>> expression".  I posted to the php and javascript newsgroups, but they 
>> said that it was probably from the fop.
> 
> Well, if you'll allow me to bounce back:
> The error has nothing to do with FOP. It is an error raised by the 
> browser, pointing to invalid Javascript embedded in HTML. In the 
> nastiest case, it could simply be a silly missing quote somewhere in the 
> generated HTML... :/

I looked at this last paragraph of yours and starting thinking.  I was 
seeing that message in Firebug.  I also saw there what the entire 
command string was.  That was from a print statement.  When I removed 
that print statement, the error message disappeared.

Now I am left with wondering why the exec command didn't create the pdf 
-- but that is a different problem.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: invalid flag after regular expression

Posted by Andreas Delmelle <an...@telenet.be>.
On 13 Nov 2008, at 19:38, Sheldon Glickler wrote:

Hi

<snip />
> I use php code to generate the xml file.  This php is invoked via an  
> AJAX call.  After the xml file is generated I use the php command
>
> exec(the_command_string_for_running_the_php);

How is the setup precisely? Since mixing client- and server-side  
scripting is always a bit tricky, I just want to make sure I  
understand correctly

If all is well, I'm guessing it looks a little like:
1° launch asynchronous request and return (client-side, Javascript)
2° generate the XML and send a response, indicating that it's ready to  
be converted (server-side, PHP)
3° handle the response, by sending a second request, and return  
(client-side, Javascript)
4° handle the second request, and send a response when complete  
(server-side, PHP; your 'exec();' statement)
5° handle the new response, which could be something like setting the  
'src' attribute of an IFRAME to the location where the PDF was  
generated (client-side, Javascript)

Where step 3° (5° resp.) corresponds to the AJAX onreadystatechange()  
handler attached to the request sent in step 1° (3° resp.).

> When I do that, I get the error message "invalid flag after regular  
> expression".  I posted to the php and javascript newsgroups, but  
> they said that it was probably from the fop.

Well, if you'll allow me to bounce back:
The error has nothing to do with FOP. It is an error raised by the  
browser, pointing to invalid Javascript embedded in HTML. In the  
nastiest case, it could simply be a silly missing quote somewhere in  
the generated HTML... :/



HTH!

Cheers

Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org