Question

I am using Agavi with Doctrine. The master template fails to load at times with a AgaviParseException listing out all instance of  . I'm using the latest stable versions of all technologies.

Was it helpful?

Solution

Use   for non-breaking space. You need to have valid XHTML in your template probably. Refer to this chart for reference.

OTHER TIPS

While I'm not too familiar with the tools you are using, it seems to me that the XML entity for   cannot be found. You can either include the XML entity, or you should use   instead. The reason is: there are only five predefined XML entities, all others you need to include when doing XML or XHTML (while browsers are generally more lenient).

They are part of the following for XHTML:

PUBLIC 
   "-//W3C//ENTITIES Latin 1 for XHTML//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"

and mark the following quote about XHTML when parse by an XML parser:

If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.

However, if the typo above is on purpose, it may also mean that you miss the ; at the end of the &nbsp.

I don't know what the exact problem is (please always post exception messages and other helpful information when asking questions like these), but there is really only one way for this problem to occur.

It is not the Master template failing to load, it is the form handling system that is unable to parse the complete generated output (so it can re-fill a form for you, or insert error messages from validation) in the faster and simpler XML parsing mode. In XML parsing mode (which you'd usually use for XHTML), it doesn't validate against a DTD by default, so it only knows the standard XML entities (&, ", ', < and >). HTML parsing mode doesn't have that problem. You could force Agavi to use it, but it auto-detects usage of HTML or XHTML and selects the correct mode, so that probably would not be a good idea, especially since libxml's HTML parsing can be a bit wonky at times (libxml is used by PHP's DOM implementation; most restrictions or bugs in parsing and handling of the forms are due do libxml - look at AgaviFormPopulationFilter.class.php if you want to get an idea of the workarounds that are already in place to deal with different versions of libxml and their behavior, like inserting double XML prologs when saving, breaking CDATA sections, or other weird stuff).

Anyway, I assume you are using UTF-8 in your documents, so there really is no need to use any entities for characters like "©" or "«" - you can insert them literally instead of using © and so forth. The only exception of course is a non-breaking space, which is a bit hard to see and distinguish in an editor, but as pointed out in other comments, you can use the numeric equivalent   here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top