Using HTML Entities in XPages


Often when you’re designing a web page or application you want to use HTML entities or special characters. This happens quiet often when you are using Bootstrap in your design.


For example the header in the Bootstrap modal has a close button which is defined as followed:

<div class=“modal-header”>
<button type=“button” class=“close” data-dismiss=“modal”>&times;</button>
<h4 style=“color:red;”><span class=“glyphicon glyphicon-lock”></span> Login</h4>

When you past this code in your XPage you get the following error:

The entity “times” was referenced, but not declared.

So you cannot use this in your XPage source because it is not valid XML.


The short and quick answer is to use the numerical equivalents. In our case for &times; you will want to use & #215; (mind the space since WordPress is formatting it otherwise).

In the table on this linked page you will find on overview and description of (all) HTML Entities  and their corresponding Unicode decimals.

Below is a summary of HTML Entities I use often:

&nbsp; … & #160;

&times; … & #215;

&amp; … & #38;

&euro; … & #8364;

&quot; … & #34;

&reg; … & #174;

A simple tip, but useful none the less. Happy development =)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s