We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

The entity "nbsp" was referenced, but not declared. issue in UI Page..

Shanmuga Raj
Tera Expert

I have an HTML field (text) on a knowledge base table and I want to display it's contents on a UI Page.   I can get it to correct render the contents in some instances, however in some instance I get an error when rendering the Page. 'The entity "nbsp" was referenced, but not declared.'

My code :

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null" >

<div id="source-html">
<style>
table, th, td {
border: 1px solid black;
}
</style>
<button onclick="exportHTML();">Export as .doc</button>
<g:evaluate object="true" >
var sysparm_id = RP.getParameterValue("sysparam_id");
var choices = new GlideRecord("kb_knowledge");
choices.addQuery("sys_id", sysparm_id);
choices.query();
choices;
</g:evaluate>
<j:while test="${choices.next()}">
<g:no_escape>${HTML:choices.text.getDisplayValue()}</g:no_escape>
</j:while>

</div>
</j:jelly>

Anyone Help me on this. Thanks in advance

1 ACCEPTED SOLUTION

Hi,

So definitely issue with the html within the text as it is working in this case.

I believe for all other cases where the html is valid it should work

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

21 REPLIES 21

Ankur Bawiskar
Tera Patron

Hi,

Did you try to check the html content for that article; there must be some issue in the html content

https://community.servicenow.com/community?id=community_question&sys_id=f7719f2ddbdcdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=6f52d761db101fc01dcaf3231f96...

https://stackoverflow.com/questions/13012327/error-parsing-page-xhtml-error-tracedline-42-the-entity...

Can you share complete UI page code?

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

here is my UI page code:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null" >
<!-- <!DOCTYPE html [
<!ENTITY nbsp "&#160;">
]> -->
<div id="source-html">
<style>
table, th, td {
border: 1px solid black;
display: inline;
}
</style>
<button onclick="exportHTML();">Export as .doc</button>
<g:evaluate object="true" >
var sysparm_id = RP.getParameterValue("sysparam_id");
var choices = new GlideRecord("kb_knowledge");
choices.addQuery("sys_id", sysparm_id);
choices.query();
choices;
</g:evaluate >
<j:while test="${choices.next()}">
<!-- ${HTML:choices.text} -->
<g:no_escape>${HTML:choices.text.getDisplayValue()}</g:no_escape>
</j:while>

</div>
</j:jelly>

output :

find_real_file.png

Hi,

So when you use Try it option it gave this error?

Can you try with hard coded sys_id?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

No.. I using UI action related link.. When i click that this ui page will call and showing this error