Using HTML Entities in XPages

Introduction

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.

Problem

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>
</div>

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.

Answer

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 =)

Advertisements

!NO! more struggle with XPages as RSS source and JWPlayer

I am working on embedding JWPlayer in a Domino app and I want to use an XPages to generate an RSS feed for a playlist. Via this way I can apply some ‘intelligence’ and direct which related items the playlist should contain. How the code should look like you can see here.

The problem I am facing at the moment is that JWPlayer has problems using a source that is based other that the xml extension.

Task Queue failed at step 5: Playlist could not be loaded: XML could not be parsed or playlist was empty

Whenever I save the .xsp results as an .xml file and add it to the application as a file resource and call it the player works fine.

In traditional Domino development it is possible to call an agent e.g. rss.xml but XPages does not allow it, it can only contain numbers, letters, underscore and hyphen.

  • Do you see any options using XPages or am i thrown back to writing an agent?

Update: problem solved as you can see in the image below.

Q: How to use an XPage as XML source (RSS)

I noticed that you can specify an RSS playlist for a movie in the JW Player. The playlist should be similar according like this example file.

In my Bildr application I am still relying on a the combination of a view/$$viewtemplate form/webqueryopen agent combination which seems like a deprecated approach in XPages Domino development.

Since I haven’t used an XPage before as an RSS feed I am wondering what would be the easiest approach/implementation?

  • my XPage should be able to take a document UNID as identifier
  • my XPage should perform a search and return a collection with an X number of documents from the same author (channel)

Any help is appreciated. Thanks!

I will also update the RSS feed in Bildr with the solution…

Below an impression how far I have come:

(probably the app will be uploaded on OpenNTF in case I manage to qualify for the IP scan =))

Transforming RSS feeds into HTML, run an agent or use a JS Library?

A customer asked me if it would be easy to make (snippets of) RSS feeds from Notes blog applications visible on html pages (generated by Domino)?

Sure I said, but a search on Google brought me however no direct copy and paste result.

I played before with XML and transformation but I am just wondering what would most effective and more important easy for an Editor who maintains a page?

Just adding a little JavaScript on your page and providing the url of the feed, possibly the url of a stylesheet and a parameter how many items you want to have displayed maximum sounds the easiest for me. I am already using JQuery, could I take advantage of this?

How to tackle possible domain issues? Using an agent and do the transfarmation here? What about performance?

Right now I am still searching, but if you have some guidance your help is appreciated!

PS. I looked at services as RSS Include, would be great if there would be a generic solution in Notes for such a service.