These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:22 pm Advanced search

XHTML: how to add char entities using DOCTYPE

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

XHTML: how to add char entities using DOCTYPE

Postby ssb » Tue Jun 15, 2010 5:45 am

in old xhtmls we can declare smthing like this:

<!DOCTYPE html PUBLIC A B [ <!ENTITY nbsp " "> ] >

where for example
A := "-//W3C//DTD XHTML+RDFa 1.0//EN"
B := "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"

How to do this properly in xhtml 5 ?

example(s) appreciated, TIA.
ssb
<h6>
 
Posts: 2
Joined: Tue Jun 15, 2010 5:25 am

Postby zcorpan » Tue Jun 15, 2010 9:54 am

If you want to declare entities in the internal subset, then the simplest way is to omit the FPI and SI:

Code: Select all
<!DOCTYPE html [ <!ENTITY foo "bar"> ]>
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby zcorpan » Tue Jun 15, 2010 9:56 am

However, a better solution might be to not declare any entities and not use any entities. Don't escape the characters (except < and &), just include them directly. Or if you insist on escaping them, escape them using NCRs.

...or use text/html where you can use entities without declaring them. :)
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby ssb » Tue Jun 15, 2010 2:29 pm

zcorpan wrote:
Code: Select all
<!DOCTYPE html [ <!ENTITY foo "bar"> ]>


Thanks. I tried it before, but w3 validator didn't like it...
html5.validator.nu accepts, so I presume it's ok.
ssb
<h6>
 
Posts: 2
Joined: Tue Jun 15, 2010 5:25 am

Postby zcorpan » Tue Jun 15, 2010 10:53 pm

zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests