• Register
3,890 points
11 5 2

Facelets is an XML based technology that uses XHTML+XML to generate HTML output. XML have 5 special characters that need special treatment by the XML parser.

< The start of a tag

>The end of a tag

“ The start and end of an attribute value

‘ The alternative start and end of an attribute value

& the start of an entity.

Reason of error:

Sometimes the users use < as a javascript operator rather than as an XML entity. Due to this, you will encounter an error;

“The content of elements must consist of well-formed character data or markups”.


In, essence, you are writing Javascript code in the wrong place, an XML document instead of a JS file. SO it is required to escape all XML special characters accordingly. The < must be escaped as &lt;


So, essentially, the

for ( var i=0; i < length; i++ ) {

must have to become

for ( var i=0; I &lt; length; i++ ) {

to make this XML valid.


This method makes javascript code harder to read. For better understanding put all javascript code in JS file that will be included by <script src> tag.

3,890 points
11 5 2