The Reference to Entity "Foo" Must End With the ';' Delimiter

The reference to entity foo must end with the ';' delimiter

The ampersand & is a special character in HTML and XML. If you want to use it as a normal character, you have to encode it correctly. Write & instead of &:

src="...9623&w=180&h=46&style=white&variant=text&loc=en_US"

& denotes the start of an encoded entity, such as < for <, or & for &. In your case the parser tries to interpret &w as an entity. But entities are always terminated by an ;, thus if the ; is missing you get the error message.

The reference to entity f must end with the ';' delimiter

Since this is in XML, the parser expects the & symbol to precede entities such as ".

Try replacing your & with & and everything should be fine: this will be understood as being a real ampersand by the parser.

The reference to entity subset must end with the ';' delimiter

That's because & is a reserved character in XML that means "an XML entity begins here". XML entities let you print characters or sequences of characters that are hard for you to embed in your document literally, either because you don't have it on your keyboard or because the document encoding forbids it. For instance, in (X)HTML, é prints the character "é", which is not easy to find on most US keyboard. (Available entities depend on the <!DOCTYPE> declaration of your XML document.)

The problem with that scheme is that it means you can't unambiguously leave literal & characters around your document if they can be the start of an entity, so you need to encode them as an entity to solve that problem.

You will need to replace all your stray & with &, which will print & without angering the XML parser. In your case, you should be good with replacing &subset= by &subset= in your two <link> tags.

Error parsing XML : The reference to entity version must end with the ';' delimiter

It looks like something is interpreting your document as XML rather than HTML. XML is much stricter than HTML - one of the rules is that ampersands (&) have a special meaning. They mean "here comes an XML entity", which is a special character. For instance, you can type " to insert ", or > to insert > into your document.

In this case, your code is interpreting &version on line 6 as the start of one of these entities. If you update line 6 as follows:

js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";

Then you should find that error disappears.

ERROR: The reference to entity format must end with the \';\' delimiter.'

You need to escape the & characters (as in ...&bgcolor=...) into & entity references. Otherwise, XML attempts to interpret &bgcolor as an entity reference, which isn't bound to anything in your context, and needs to be terminated by ; for valid XML anyway (but not SGML, which needs ; only if the next following character is a name character).

Using & in URL causes XML error: The reference to entity foo must end with the ';' delimiter

Replace & with & as the markup is being parsed as XML and &zoom is being parsed as an HTML entity which does not exist in XML.

Why do ampersands (&) need to be encoded in JSF? Is there a way around this?

Facelets is a XML based view technology. Any characters which have special treatment by the XML parser needs to be XML-escaped when the intent is to present them literally. That covers among others < and &. The < indicates the start of a XML tag like so <foo> and the & indicates the start of a XML entity like so &. The < must be escaped as < and the & as &.

Not escaping them in Facelets would result in the following exception for <

javax.faces.view.facelets.FaceletException: Error Parsing /test.xhtml: Error Traced[line: 42] The content of elements must consist of well-formed character data or markup.

and the following one for &

javax.faces.view.facelets.FaceletException: Error Parsing /test.xhtml: Error Traced[line: 42] The entity name must immediately follow the '&' in the entity reference.

This is not specifically related to JavaScript, this applies to the entire view, including "plain text". Those characters just happen to be JavaScript operators as well. There's no way to go around this, that's just how XML is specified. In JavaScript, there's however one more way to avoid escaping or using CDATA blocks: just put that JS code in its own .js file which you load by <script> or <h:outputScript>.

In EL, there is also the && operator which also needs to be escaped as && as well, but fortunately there's an alias for this operator, the and operator.

See also:

  • Mozilla Developer Network - Writing JavaScript for XHTML

The reference to entity useLegacyDatetimecode must end with the ';' delimiter

Similar to this. To embed an ampersand character in a url it needs to coded as &

<property name="url" value="jdbc:mysql://localhost:3306/mz_db?useSSL=false&useLegacyDatetimecode=false" />


Related Topics



Leave a reply



Submit