File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The entity "nbsp" was referenced, but not declared

 
kapil Gupta
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Am converting HTML content to XML. While conversion, I recveive following error if my html contains a space ( ) character.

How can I resolve this issue?
Thanks.
kapil
 
Paul Clapham
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on how you are doing the conversion. Would you like to provide some information about that?
 
kapil Gupta
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am very sorry for the late reply. Am using XSLT to transform HTML to XML. The web based UI allows user to enter content from a rich text editor and on submission am converting it to XML.

The error occurs while parsing the html content.
I was able to suppress the error by replacing nbsp with its ascii code #160; but if there are more than one html space character, it results in only one white space in XML.
What is the correct way to handle html space character?
Thanks,
Kapil

[ March 23, 2007: Message edited by: kapil Gupta ]

[ March 23, 2007: Message edited by: kapil Gupta ]

[ March 23, 2007: Message edited by: kapil Gupta ]
[ March 23, 2007: Message edited by: kapil Gupta ]
 
Paul Clapham
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You already found out one of the correct ways: use   for a non-breaking space. The entity   isn't one of XML's predefined entities, so if you want to use it in an XML document then you have to provide a DTD that declares what it means. That's another correct way.
 
pete reisinger
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prepend:

<?xml version="1.0"?>
<!DOCTYPE some_name [
<!ENTITY nbsp "&#160;">
]>

then parse the string
This will replace all nbsp entities for the xml ones
 
Syera Syailendra
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all i have same problem how to fix it?



The entity "a.performance.timing" was referenced, but not declared

anyone can help me please email me
my address here http://syerasite.com

Thank you

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic