Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: is there a way to tell validator to ignore deliberate markup validation errors?

1. ## is there a way to tell validator to ignore deliberate markup validation errors?

is there a way to tell validator to ignore deliberate markup validation errors?

all the time, there are non-html codes on my page which don't comply with html validation, but nonetheless get picked up as such. they have a legit role amongst my html and can't be done away with. eg thirdparty widgets, math markup, etc.

it's annoying for 3 reasons: firstly people in this forum will be led to misperceive me as sloppier than i actually am and don't take me as seriously; second SEO takes a hit, and lastly, it's hard to comb thru a page of hundreds of markup errors just to find the genuine errors i'm interested in fixing.

2. OK, I assume you’re talking about the site in your signature and I validated the differentiation intro page, and really, most of the errors don’t seem deliberate due to any math markup or third party widgets (FB Like button) but simply because you:

1. Forgot to encode special characters as HTML entities (like ampersands as &amp;, < as &lt; etc.)
2. Are using an inline frame although this is not allowed with a strict doctype (OK, I see this is from an Amazon widget)
3. Didn’t to implement the FB Like button properly, using the respective xmlns attribute in your opening <html> tag (and putting the respective meta tags which apparently don’t validate by themselves but with a little workaround: http://stackoverflow.com/questions/2...answer-3221120)
4. Forgot to close some elements properly.

You can get rid of most of the errors already if you encode any occurrence of & as &amp;. It’s unfortunate that Amazon provides an iframe for the widget but if you really need the pages to validate then add that iframe with JS or something. I’m kinda happy that you are using the XHTML strict doctype so I wouldn’t want you to resort to transitional (where iframes – among a lot of other crap – would be regarded as valid). Another option – although I don’t know how the current state of support is (especially in IE) – is to replace the iframe with an object element since not only you can include Flash with the object element but also other things like HTML or PDF documents: http://joliclic.free.fr/html/object-tag/en/.

3. ## Users who have thanked VIPStephan for this post:

ptrcao (02-12-2011)

4. Thanks VIPSteve; right, I've not been especially motivated to clean up that particular page because it's rampant with errors from the Amazon widget, making it difficult to sift through and pick up my own errors...

http://validator.w3.org/check?uri=ht...Inline&group=0

To show you what I mean, it's difficult to avoid this kind of thing:

Here is an example of math markup where the "&" symbol has no choice but to remain as such; cannot encode as "&amp;" as the program reading this needs to see "&". (It's being used as an alignment marker.)
…t{conjugate}}{\text{conjugate}}\$)} \\ &=\lim_{h \rightarrow 0} \frac{(16+h)-16…

I'll definitely follow up with your useful suggestions. Did the results of that validation test really suggest that my errors outnumbered the amazon widget errors? I didn't know my errors were that bad!

I'll definitely be interested to try your solution to clean up the path of destruction left by this troublesome little amazon widget.

5. Well, maybe it helps to denote the math markup as “character data” (CDATA – as opposed to PCDATA: parsed character data)?

Should do the trick if you write it like:
Code:
<li> The gradient of tangent, denoted $$y'(x)$$ is a limit of the form
<![CDATA[
\begin{align*}
\lim_{h \rightarrow 0} \frac{y_2-y_1}{x_2-x_1}
&= \lim_{h \rightarrow 0} \frac{f(x_2)-f(x_1)}{x_2-x_1} \\

&= \lim_{h \rightarrow 0} \frac{f(x_1+h)-f(x_1)}{(x_1+h)-{x_1}} \\
&= \lim_{h \rightarrow 0} \frac{f(x_1+h)-f(x_1)}{h}
\end{align*}
]]>
</li>
Now, the iframe can’t be valid in strict XHTML since it itself is not allowed. But you’ll at least get less errors if you, as I said, encode the ampersands in the URL as &amp; (don’t worry, the URL will still work) and remove the nevertheless invalid attributes like marginwidth/marginheight, etc. To get it completely valid you can try to convert the iframe to an object like this:

Code:
<object type="text/html" data="http://rcm.amazon.com/e/cm?t=mathanno-20&amp;o=1&amp;p=6&amp;l=st1&amp;mode=books&amp;search=math%20trigonometry&amp;fc1=000000&amp;lt1=&amp;lc1=3366FF&amp;bg1=FFFFFF&amp;f=ifr" style="border:none; width: 120px; height: 150px;">(alternative content here, e. g. the plain link to the source)</object>
However, as proper support was always limited in some browsers, especially when it comes to styling. I don’t know how the current state is as I haven’t tried this for a few years.

6. ## Users who have thanked VIPStephan for this post:

ptrcao (02-12-2011)

7. Originally Posted by VIPStephan
Well, maybe it helps to denote the math markup as “character data” (CDATA – as opposed to PCDATA: parsed character data)?

Should do the trick if you write it like:
Code:
<li> The gradient of tangent, denoted $$y'(x)$$ is a limit of the form
<![CDATA[
\begin{align*}
\lim_{h \rightarrow 0} \frac{y_2-y_1}{x_2-x_1}
&= \lim_{h \rightarrow 0} \frac{f(x_2)-f(x_1)}{x_2-x_1} \\

&= \lim_{h \rightarrow 0} \frac{f(x_1+h)-f(x_1)}{(x_1+h)-{x_1}} \\
&= \lim_{h \rightarrow 0} \frac{f(x_1+h)-f(x_1)}{h}
\end{align*}
]]>
</li>
Now, the iframe can’t be valid in strict XHTML since it itself is not allowed. But you’ll at least get less errors if you, as I said, encode the ampersands in the URL as &amp; (don’t worry, the URL will still work) and remove the nevertheless invalid attributes like marginwidth/marginheight, etc. To get it completely valid you can try to convert the iframe to an object like this:

Code:
<object type="text/html" data="http://rcm.amazon.com/e/cm?t=mathanno-20&amp;o=1&amp;p=6&amp;l=st1&amp;mode=books&amp;search=math%20trigonometry&amp;fc1=000000&amp;lt1=&amp;lc1=3366FF&amp;bg1=FFFFFF&amp;f=ifr" style="border:none; width: 120px; height: 150px;">(alternative content here, e. g. the plain link to the source)</object>
However, as proper support was always limited in some browsers, especially when it comes to styling. I don’t know how the current state is as I haven’t tried this for a few years.