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
Equal Height Rows in a Flex Container
Nesting Block Level Elements Inside the ≪P≫ Tag... Right or Wrong
What's the Difference Between Disabled="Disabled" and Readonly="Readonly" for HTML Form Input Fields
Is Either Get or Post More Secure Than the Other
How to Create Your Own HTML Tag in Html5
How to Make a Whole Row in a Table Clickable as a Link
Get the Value in an Input Text Box
Can HTML Checkboxes Be Set to Readonly
I Need an Unordered List Without Any Bullets
Difference Between Id and Class in Css, and When Should I Use Them
Are Custom Elements Valid Html5
Force Ie Compatibility Mode Off Using Tags
Why Are My Css3 Media Queries Not Working on Mobile Devices
Difference Between HTML Div and Span Elements
Submit Form Using a Button Outside the ≪Form≫ Tag