W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2002

RE: Entities, Tidy and valid XML.

From: Jelks Cabaniss <jelks@jelks.nu>
Date: Mon, 4 Mar 2002 18:47:08 -0500
To: <html-tidy@w3.org>
Message-ID: <001201c1c3d6$e7e3acc0$6501a8c0@blackie>
Matthew Stanfield wrote:

> Please ignore my earlier email, someone has just told me I 
> need to define all entities in an xml document apart from: 
> &amp; &apos; &gt; &lt; &quot; [&, ', >, <, "].

Yes.  I see this is becoming a FAQ here too, so ...

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

Q.  Why doesn't &nbsp; (or &copy;, or &Whatever;) work in XML?

A.  They *will* work if and only if you've referenced a DTD that
declares them for you, such as the XHTML 1.0 Strict DTD at

	http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

or you have declared them yourself, as in ...

   <?xml version="1.0"?>
   <!DOCTYPE doc [
     <!ENTITY nbsp "&#160;">
     <!ENTITY copy "&#169;">
     <!ENTITY alef "&#x05d0;">
   ]>
   <doc>
      <p>A non-breaking space is invisible, 
      but if you could see it, it would look 
      like this: &nbsp;.</p>

      <p>The first letter of the Hebrew 
      alphabet is &alef;.</p>

      <p>This FAQ &copy; 2002 by XML 
      Anonymous</p>
   </doc>

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


/Jelks
Received on Monday, 4 March 2002 18:47:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:51 GMT