Missing } in XML expression

Posted May 26th, 2011 in Razno by Metod

Today I got frustrated because when trying to parse a json string with jQuery, apparently it was causing a Missing } in XML expression error. But doing a bit more research I found the true problem. Boy was I wrong.

What was the problem?

  1. <script type="text/javascript"><script type="text/javascript"> …

And since Firefox and Firebug showed me purified and corrected HTML, I had no way of knowing that. So when you get this error next time, check for this situation. :)

Phing executing multiple commands

Posted March 26th, 2011 in Zanimivosti by Metod

A little tip. If you deploy your PHP projects with Phing, you are familiar with the file build.xml. If you want to execute multiple commands, that depend on each other to be executed, you have to use && in between the commands. For example, clearing the cache:

  1. ssh user@example.com ‘cd cache && rm *’

The line in phing build.xml would look like this:

  1. <exec command="ssh user@example.com ‘cd cache && rm *’ />

But typing it like that will produce an error, since it is not a well-formed XML document. You have to transform the &’s into entities.

  1. <exec command="ssh user@example.com ‘cd cache &amp;&amp; rm *’ />

This will work as expected.