Re: How tags are reported

On 28 May 2018, at 20:16, Mike McCutcheon wrote:

> This is presumably because my php code uses the htmlspecialchars() 
> function
> to convert the predefined characters "<" and ">" in the stored email 
> into
> HTML entities.

> Is that OK or should the validator report errors to me ? For example, 
> is the
> validator only saying the HTML is error-free because it doesn't 
> recognize
> some of it as HTML because the tags have been converted ?

The validator will correctly interpret `&gt;` as the HTML code for "Show 
a greater than sign here" (and so on for other entities).

If you are putting that somewhere that is allowed, then it will be 
valid.

     <div>&gt;</div>

If you are putting it somewhere forbidden, then it will report an error.

     <div &gt;></div>

*Attribute `&gt;` not allowed on element div at this point.*

If you write an HTML document which contains the HTML to express the 
source code of another (invalid) HTML document as part of the 
document…

     <!DOCTYPE html>
     <meta charset="utf-8">
     <title>For example</title>
     <div>
         &lt;!DOCTYPE html>
         &lt;p>Invalid HTML because the title is missing
     </div>

… then it will tell you the document is valid.

It will not attempt to validate the HTML document being rendered by the 
HTML.

i.e.

     <!DOCTYPE html>
     <p>Invalid HTML because the title is missing

… will not be tested for validity as an HTML document in its own 
right.

Received on Tuesday, 29 May 2018 15:28:07 UTC