xhtml/xml compliancy

General TRichView support forum. Please post your questions here
Post Reply
wvd_vegt
Posts: 83
Joined: Tue Aug 30, 2005 7:39 am

xhtml/xml compliancy

Post by wvd_vegt »

Hi Sergey

My xml guru just told me that the   you use frequently in your xhtml export are not complaint and cause many problems (missing entity declarations).

She suggest that you change them to their numeric equivalent (from memory she tought it was &160; which don't cause any problems when viewing the xml. She also thought there was a unicode numeric version.

Sergey Tkachenko
Site Admin
Posts: 14899
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Can you give me a link to document explaining this issue?

wvd_vegt
Posts: 83
Joined: Tue Aug 30, 2005 7:39 am

Post by wvd_vegt »

Hi,

The browser doesn't matter as long as it sees the output as html. But when you drop a xhtml saved as xml and removed the doctype as it's not understood by IE, it shows:

Code: Select all

The XML page cannot be displayed 
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

Parameter entity must be defined before it is used. Error processing resource 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd...

%xhtml-prefw-redecl.mod;
-^
 
then IE will not show it once two spaces are typed and this a   is inserted. This is caused by the modular design of the dtd for xhtml v1.1. which IE doesn't support.

IE shows the page correct if you insert a entity declaration like:

Code: Select all

          <!DOCTYPE html [
          <!ENTITY nbsp   " ">
          ]>
But it needs to be done for each entity used.

Firefox shows the page correctly including the docytpe and the nbsp's. BUt I'm not sure what happens if your not online and firefox can't access the dtd's url.

Code: Select all

XML Parsing Error: undefined entity
Location: file:///C:/Pim/temp/source.xml
Line Number 65, Column 25:<p>http://www.google.nl &nbsp; x</p>
So bassically &nbsp; needs a dtd with the entity declared to be present, < not. The sample above shows &nbsp; is defined as
See for example:

http://webstandardsgroup.org/features/tommy-olsson.cfm
The doctype declaration tells a validator which grammar the document claims conformance with. It is required if you want to validate your markup. Browsers may read a specified DTD, but they are not required to (and most don't). That means you should not use HTML character entities like &nbsp; in XHTML, since they are declared in the DTD. Use numeric references instead (e.g.   or &#xA0;).

Sergey Tkachenko
Site Admin
Posts: 14899
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Added in to-do list: to add an option for saving named entities as character codes.
NBSP is not the only named character enity used.
Others are: GT, LT, AMP, and a number of characters for saving text of Symbol and Wingdings fonts.

Rob
Posts: 52
Joined: Wed Sep 07, 2005 6:47 am

Post by Rob »

Please also add the option to include entity declarations for all non standard entities.

MagnusW
Posts: 24
Joined: Mon Aug 23, 2010 7:31 am

Still nbsp in xhtml.

Post by MagnusW »

Hi Sergey, I am working with your xhtml export. Seems like it still produces &nbsp; which later in my tool-chain breaks the xml parser (standard TXMLDocument)

You asked for references. According to wikipedia:)

http://en.wikipedia.org/wiki/List_of_XM ... references

the only characters escaped by &...; in xml are: quot, amp, apos, lt and gt

Sergey Tkachenko
Site Admin
Posts: 14899
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It looks like our XHTML refers to a wrong dtd:
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd
I cannot find references to character entities in it.

I will change to
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
and
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

They start from

Code: Select all

<!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
   "xhtml-lat1.ent">
%HTMLlat1;

<!ENTITY % HTMLsymbol PUBLIC
   "-//W3C//ENTITIES Symbols for XHTML//EN"
   "xhtml-symbol.ent">
%HTMLsymbol;

<!ENTITY % HTMLspecial PUBLIC
   "-//W3C//ENTITIES Special for XHTML//EN"
   "xhtml-special.ent">
%HTMLspecial;

Sergey Tkachenko
Site Admin
Posts: 14899
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Implemented in TRichView 15.6 (available for registered users as a beta)

Post Reply