[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Polyglot XHTML5 Validator?
- From: David Carlisle <davidc@nag.co.uk>
- To: Jesper Tverskov <jesper.tverskov@gmail.com>
- Date: Sun, 22 May 2011 14:43:13 +0100
On 22/05/2011 14:16, Jesper Tverskov wrote:
> Hi David
>
> You forgot to comment on this one:
> *** Also I think we need an assertion testing that document.write()
> and document.writeln() are not used.
ah sorry, hmm well I could do a simple check on inline scripts
but I can't really check external script an even for inline scripts if
the script has a comment,
//can't use document.write()
then it would fail the test unless the test used a real javascript
parser, which is out of scope here.
so I can't check all cases and will get the wrong answer on some cases I
do check so (possibly) it's better just to document that the check is
not done. this is not so different from if teh scriot uses innerHTML,
which is allowed but only if the string inserted does itself meet the
constraints of the polyglot document. If you need that level of checking
then this kind of declarative schema isn't really what you want, you
just need to parse the document as xhtml and html and then do a
comparison of the resulting dom trees.
>
> You say that you don't want to make an assertion disallowing:
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> because: "I only want to test clauses in the polyglot spec, so perhaps
> you should raise a bug against that?
>
> I will do that. So please make the assertion, we need it. It will be a
> very common error. It is too stupid that I and others will have do
> make an improved version of your schema.
Actually I don't think this is needed at all, the meta statement won't
affect the dom produced by either an html or xhtml parser as far as I
can see.
>
> *** I think it is damaging that we cannot test for not allowed named
> entity references, since it is bound to be a very common error.
As I say the schematron assumes that teh input is well formed xml and
valid html, so any entity names, if used, will be correct. then when
parsed as xml either it will work correctly (if a dtd is read) or it
will be an xml parse error. You won't get strangely incompatible doms.
>
> Why not make an assertion using unparsed-text(), it is not in XPath
> but will make it to the XSLT stylesheet and should work, I guess. You
> could write the necessary regex faster than the rest of us can check
> our mail on our iPhone.
the necessary regexp is (more or less) in the htmlparse stylesheet
available at the same site, however it would have the same problems as
checking for document.write giving a lot of false faiures. For example
the mathml spec avoids using entity references by using a style
<mo>↔<!-- → --></mo>
this would fail a check using unparsed-text() unless I tried to filter
out comments and things and this would be very fragile.
David
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]