Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Content Editor Discussions /

Forum for content editors and CMS users.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Can't Use & Symbol?

Go to End

13 Posts   4756 Views


Community Member, 53 Posts

27 January 2009 at 1:40am

If I put the & symbol into the content of an article page, the system freaks out (v2.2.3). This is what I get:

XML Parsing Error: not well-formed
Line Number 248, Column 43:			<li class="newsSummary">In a dystopic & crime ridden Detroit, a terminally wounded

I case it doesn't line up right, the ^ is pointing to the & symbol. Why does it care what's in my text field?


Community Member, 501 Posts

27 January 2009 at 4:00am

It doesn't care but '&' isnt valid xhtml/xml so what you need to do is add .XML to your variable in the template. (Assuming you use something like Summary...

Another option is to remove the xml prolog from the top of your template, because it'll probably get broken again.

What's happening here is that the page is rendering invalid xhtml in a strict xml page, it's not really related to the system.


Community Member, 14 Posts

27 January 2009 at 8:42am

& is invalid xhtml. Instead you can replace it with &amp; This is the ascii character code for &.


Community Member, 501 Posts

27 January 2009 at 8:45am

@JasonS Normally you don't need to do this yourself for the stuff you put in a HtmlEditorField.


Community Member, 53 Posts

27 January 2009 at 9:26am

As more clarification, it works fine in the title field but freaks out if it's in the content field. I get that it's invalid XML, I just don't get why it's an issue coming out of a text field that it should only be interpreting as HTML, not XML, right?

@dio5 - My template is straight out of the tutorials. Where, specifically, would I need to make changes?

@JasonS - The code behind the field actually uses &amp;

<p align="center">&nbsp;In a dystopic&nbsp;&amp; crime ridden Detroit, ...

The workaround is to spell it out, obviously.


Community Member, 501 Posts

27 January 2009 at 9:32am

Edited: 27/01/2009 9:33am

Just had a look at - saw you replaced it with 'and'.

I don't know what's in the tutorials, so if you could show us yr template code? It's probably the method you use on the holder page to display just a part of the text that's causing it. But if the source code of that page shows &amp; as well?!


Community Member, 53 Posts

27 January 2009 at 10:22am


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns="" xml:lang="en" >
		<% base_tag %>
		<link rel="stylesheet" type="text/css" href="mysite/css/layout.css" />
		<link rel="stylesheet" type="text/css" href="mysite/css/typography.css" />
		<link rel="stylesheet" type="text/css" href="mysite/css/form.css" />
		<div id="Main">
			<ul id="Menu1">
				<% control Menu(1) %>
					<li class="$LinkingMode"><a href="$Link" title="Go to the &quot;{$Title}&quot; page">$MenuTitle</a></li>
				<% end_control %>
			<div id="Header">
			<div id="ContentContainer">
			<div id="Footer">
				<span>Visit <a href="" title="Visit"></a>; to download the CMS</span>
<% include Menu2 %>
<div id="Content" class="typography">		
	<ul id="NewsList">
		<% control Children %>
			<li class="newsDateTitleSmall"><a href="$Link" title="Read more on &quot;{$Title}&quot;">$Title</a></li>
			<li class="newsDateTitleSmall">Released in $Date.Year</li>
			<li class="newsSummary">$Content.FirstParagraph <a href="$Link" title="Read more on &quot;{$Title}&quot;">Read more &gt;&gt;</a></li>
		<% end_control %>
<center>For more information about any of the movies, shows or actors you see here,
<br>visit <a href="" target="_blank">The Internet Movie Database (IMDB)</a>
<br><strong><a href=" Archive Feedback">Click here to send email to Uncle Bubby</a></strong></center>

 * Defines the ArticleHolder page type
class ArticleHolder extends Page {
   static $db = array(
   static $has_one = array(
   static $icon = "tutorial/images/treeicons/news";
   static $allowed_children = array('ArticlePage');
class ArticleHolder_Controller extends Page_Controller {
function rss() {
  $rss = new RSSFeed($this->Children(), $this->Link(), "The coolest news around");
function init() {
   RSSFeed::linkToFeed($this->Link() . "rss");	


Community Member, 501 Posts

27 January 2009 at 10:39am

Edited: 27/01/2009 10:41am


what if you replace





Go to Top