2014-09-04 73 views
1

W3C HTML 4 fragment validator之间的差异接受验证码:当相同的代码提交给使用HTML5模板W3C validator文档中HTML转义码和W3C HTML4和HTML5验证

<a href='http://www.sparql.org/sparql?query=+PREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0A+SELECT+%3FAgent%0D%0A+FROM+%3Chttp%3A%2F%2Fwww.w3.org%2F2012%2FpyRdfa%2Fextract%3Furi%3Dhttp%3A%2F%2Fontomatica.com%2Fpublic%2Ftest%2F2_infotext.html%3E%0D%0A+WHERE%0D%0A+{%0D%0A+%3Fs+foaf%3AAgent+%3FAgent+.%0D%0A+}%0D%0A&amp;default-graph-uri=&amp;output=text&amp;stylesheet=%2Fxml-to-html.xsl' title='Click here to query the page using SPARQL'><img src='http://www.example.com/public/bin/logo_sparql.png' alt='Run SPARQL query'/></a> 

,它报告:

Bad value for attribute href on element a: Illegal character in query: not a URL code point. 

在位置SPARQL'><img

为了我的眼睛没有字符必须转义(如管道字符)。

我该如何改变,以便HTML5验证程序接受该元素?

+1

您的大括号'{'可能需要编码为'%7B'。 – Brad 2014-09-04 22:27:49

+0

correctomundo布拉德! (对造纸小说爱好者表示歉意)。请回答,以便我可以接受答案。 – 2014-09-04 22:37:45

回答

1

如果您逃过{}作为%7B%7D,它的工作原理。

<a href='http://www.sparql.org/sparql?query=+PREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0A+SELECT+%3FAgent%0D%0A+FROM+%3Chttp%3A%2F%2Fwww.w3.org%2F2012%2FpyRdfa%2Fextract%3Furi%3Dhttp%3A%2F%2Fontomatica.com%2Fpublic%2Ftest%2F2_infotext.html%3E%0D%0A+WHERE%0D%0A+%7B%0D%0A+%3Fs+foaf%3AAgent+%3FAgent+.%0D%0A+%7B%0D%0A&amp;default-graph-uri=&amp;output=text&amp;stylesheet=%2Fxml-to-html.xsl' title='Click here to query the page using SPARQL'><img src='http://www.example.com/public/bin/logo_sparql.png' alt='Run SPARQL query'/></a>