Pages: 1
Print
Author Topic: DITA OT error: The entity "nbsp" was referenced, but not declared.  (Read 7384 times)
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« on: November 29, 2012, 06:08:57 PM »

Product(s):
XMetaL Author Enterprise 7.0 (running DITA OT version 1.5.4)
Later versions will very likely continue to be equally affected.

Description:
Generating output fails and the following error appears in the DITA Open Toolkit output log file (log.xml opened in XMetaL):
Quote
[conref] <path to one of your topic files>:<line#>:<column#>: Fatal Error! Error reported by XML parser Cause: org.xml.sax.SAXParseException: The entity"nbsp" was referenced, but not declared.

Cause:
The DITA OT defaults to running the XML parser it uses for transformations with a mode called "parser grammar caching" turned on. When character entities are used that feature will throw this error. Enabling the feature is meant to speed up processing so that the DITA OT can generate output faster.

Resolution:
Turn off "parser grammar caching". See the note listed next to the parameter named args.grammar.cache on this page:
http://dita-ot.sourceforge.net/1.5.4/readme/dita-ot_ant_properties.html

Resolution Instructions for XMetaL Author Enterprise 7.0
Add the parameter named args.grammar.cache and set its value to "no".

1. Launch XMetaL Author Enterprise 7.0.
2. From the Tools menu select Configure Output...
3. In the Configure Output dialog switch to the Advanced tab.
3. On the Advanced tab inside the textbox at the bottom labelled "Other output parameters" add the following on a separate line exactly as follows:
ANT_PARAM_args.grammar_cache = no
*Do not change any other settings.*
5. Select OK to dismiss the dialogs and save this new parameter.

You should now be able to use &nbsp; in your DITA topics.

Deprecated:
This should only be considered a temporary solution as the DITA TC at OASIS has placed the following note into the DITA DTDs suggesting they plan to remove the declaration for this character entity reference from future versions of the DITA DTDs:

Quote from: DITA 1.2 DTD topic.mod file
<!-- ============================================================= -->
<!--                COMMON ENTITY DECLARATIONS                     -->
<!-- ============================================================= -->

<!-- Use of this entity is deprecated; the nbsp entity will be
     removed in DITA 2.0.                                          -->
<!ENTITY nbsp                   "&#xA0;"                             >

So, with future versions of the DITA DTDs, DITA files containing this entity would be invalid XML. Any XML parser parsing your files would need to tell you that and terminate processing (part of the XML Recommendation). That would include both XMetaL and the XML parser being used by the DITA OT (regardless of settings) which is usually either Saxon or Xerces.

Recommendation:
Use an actual NO-BREAK SPACE (official Unicode character names are all uppercase) character instead of the entity. If you insert the character itself and not the entity then the DITA OT (specifically, the parser processing your files) will not complain. Your files should also be valid when you move to the next version of DITA, if those DTDs do stop declaring this entity. If they do stop declaring this entity the only way to continue to use it would be to alter the DTDs (I would not recommend that) or to declare the entity in every XML file you wish to use it in.

You can use your Windows numeric keypad keys and the "numpad Alt sequence" method for entering this character (as you can with most Windows applications). The numpad character entry sequence is: Alt+255.

An alternative would be to use the Windows "Character Map" tool. You can copy any character and paste it into a document, including a "NO-BREAK SPACE" (which charmap.exe lists in camelcase as "No-Break Space"). If you use an IME (common with complex languages such as Japanese, Chinese, Korean, etc) you may also find a method for inserting this character there.


« Last Edit: December 13, 2012, 01:52:56 PM by Derek Read » Logged
rnv
Member

Posts: 48


« Reply #1 on: June 04, 2014, 02:29:03 AM »

Hi Derek,
I updated the Configure Output as you described. But I am still getting the error because of 'nbsp' when i publish webhelp.
i attached the screenshot.

I included that in Configuration Output Option / Advanced tab. I also tried adding it in webhelp output in advanced. but did not help.

Any idea what could i have done wrong?

xmetal version: 7.0.0.103

will really appreciate,

with best regards,
rnv


* Configure Output Options-xmetal.png (15.86 KB, 448x439 - viewed 888 times.)
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #2 on: June 05, 2014, 06:55:23 PM »

Not sure. It could be that your version (which I think is the first version of 7 that we released) includes an older version of the DITA OT that doesn't support that parameter. When I tested this and posted this forum posting I was probably running 7.0.0.111 (my mistake for not recording the full version in that post).

I don't see the same issue with XMetaL Author Enterprise 9 (which includes DITA OT 1.8). It looks like newer versions of the DITA OT actually strip this entity out completely resulting in content being run together without any spaces at all. Perhaps that is one more reason to avoid its use (the other being that your files will eventually be treated as invalid once the DTDs for 2.0 are released and if you use them). Using a NO-BREAK SPACE character still gives you the expected output.
Logged
Pages: 1
Print
Jump to: