validating xhtml entities
Jesse Alama <alama <at> stanford.edu>
2012-05-18 15:38:01 GMT
I like the way that nXML mode validates my XML documents on the fly.
It seems that concerning entities, though, there can be false
negatives (i.e., nXML says that the document is valid, but it is not).
For example, in XHTML, one can write, say
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>An XHTML 1.0 Strict standard template</title>
</head>
<body>
<p> </p>
</body>
</html>
and this document is (correctly) judged to be valid. Plugging in a
bogus entity
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>An XHTML 1.0 Strict standard template</title>
</head>
<body>
<p>&bogus;</p>
</body>
</html>
is likewise judged to be valid, but this is not correct, at least
under the definition of "valid" that matters for my purposes (the
result needs to be valid XHTML -- validator.w3.org flags the bogus
entity as bad XHTML).
To verify entities in XHTML, one could just scan the document,
comparing every entity occurring inside it against a fixed list of
acceptable XHTML entities. I would rather not code such a thing,
though, unless it's really necessary. Judging from the documenation
(in the "DTDs" section of the nXML info docs), I gather that indeed
nXML does not care to "validate" entities in the sense I intend. But
perhaps I'm wrong.
Thanks,
Jesse
--
Jesse Alama
http://centria.di.fct.unl.pt/~alama/
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/emacs-nxml-mode/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/emacs-nxml-mode/join
(Yahoo! ID required)
<*> To change settings via email:
emacs-nxml-mode-digest <at> yahoogroups.com
emacs-nxml-mode-fullfeatured <at> yahoogroups.com
<*> To unsubscribe from this group, send an email to:
emacs-nxml-mode-unsubscribe <at> yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/