473,387 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Looking for HTML validator

Hi!

I am looking for HTML validator with the following restrictions:
1. Web server is the localhost (page should be validated locally).
2. The page is dynamic (generated by PHP with client side javascript,
which alters the DOM).

I tried the following:
1. Tidy Firefox extenstion (http://users.skynet.be/mgueury/mozilla/).
Unfortunately, it doesn't really makes the real DOM validation. In my
JS code, I had .inerHTML code injection, but this extension didn't show
the injected html code.
2. I am using FireBug Firefox extenstion. This extenstion shows the
real DOM, but unfortunately it doesn't validate the HTML.
3. MS developper toolbar for IE and Web Developper Firefox extenstion
make only external HTML validation.

Any advise?

Thanks a lot!

Vadim

May 15 '06 #1
12 3113
Vadim wrote:
1. Web server is the localhost (page should be validated locally).
http://validator.w3.org/source/
2. The page is dynamic (generated by PHP with client side javascript,
which alters the DOM). 2. I am using FireBug Firefox extenstion. This extenstion shows the
real DOM, but unfortunately it doesn't validate the HTML.


Take the generated markup and paste it into the validator.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
May 15 '06 #2
Thanks for help, but it's a liitle difficult to make...
Are there any real-time DOM validators?

May 16 '06 #3
VK

Vadim wrote:
Are there any real-time DOM validators?


There is only one King :-)

You can install Firefox add-on at
<https://addons.mozilla.org/firefox/249/> Please not that HTML Tidy is
called there "HTML Validator" but it is not in the sense of W3C
Validator. Some differences are presented (Tidy is more relaxed in
favor of the real world practice). Yet it is a rather nice markup
checker and pritty-printer. You can use it at the debug time and make
the final validation at validator.w3.org

May 16 '06 #4
VK wrote:
Are there any real-time DOM validators?
You can install Firefox add-on at
<https://addons.mozilla.org/firefox/249/>
And that does what the author wants? Cool.

Hang on everyone! This is VK! I don't think I've ever responded to one of
his posts without my answer basically boiling down to "You're wrong!", but
I haven't fiddled with this extension before (it is based on tidy, and I
don't much care for tidy's attempts at syntax checking) so how about some
testing?

First I construct a test document...

http://dorward.me.uk/tmp/mod.html

A very simple HTML 4.01 Strict document with two buttons that call
JavaScript functions that modify the document - one uses DOM methods to add
an image that (a) lacks an alt attribute and (b) is being added somewhere
it isn't allowed, the other uses innerHTML to modify the document so the
body looks like:

<body>
</p><p>xxx</p></p>
</body>

Download and install the Tidy extension that VK referenced fire it up
and ...

Valid!

Excellent. It hasn't got any false positives from this documents then. Now
how about we try my scripts.

First the DOM script. Clicky, Clicky. Hmm. Still "valid".

Then the innerHTML script. Clicky, Clicky. Hmm. Still "valid".

So no. It doesn't work as VK claims ... hang on a minute.

Oh my. Why did I bother? I've just gone back and looked at the post that
started this thread. VADIM HAD ALREADY TRIED THAT EXTENSION AND DISMISSED
IT AS NOT DOING WHAT HE WANTED! ARGH!
Please not that HTML Tidy is
called there "HTML Validator" but it is not in the sense of W3C
Validator.
Actually, the current beta has a real SGML parser
Some differences are presented (Tidy is more relaxed in
favor of the real world practice).
No, it isn't. It has bugs, and as far as I'm aware they are recognised as
bugs and not fobbed off as "real world practise", I think you may be mixing
it up with that CSE thingy.
Yet it is a rather nice markup checker and pritty-printer. You can use it
at the debug time and make the final validation at validator.w3.org


Just so long as you remember to do a proper check and don't get lulled into
a false sense of security.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
May 17 '06 #5
VK

David Dorward wrote:
VK wrote:
Are there any real-time DOM validators?
You can install Firefox add-on at
<https://addons.mozilla.org/firefox/249/>


And that does what the author wants? Cool.


OP wanted something to not run after each change to w3.org This is what
has being said in the post I read and answered.
Hang on everyone! This is VK! I don't think I've ever responded to one of
his posts without my answer basically boiling down to "You're wrong!", but
I haven't fiddled with this extension before (it is based on tidy, and I
don't much care for tidy's attempts at syntax checking) so how about some
testing?

First I construct a test document...

http://dorward.me.uk/tmp/mod.html

A very simple HTML 4.01 Strict document with two buttons that call
JavaScript functions that modify the document - one uses DOM methods to add
an image that (a) lacks an alt attribute and (b) is being added somewhere
it isn't allowed, the other uses innerHTML to modify the document so the
body looks like:


I'm missing the point of this exersice. Of course using DOM methods and
even document.write I can bring the runtime document structure in the
state far away from what was originally presented to any validator. So
what's the point? Validator of any kind (including the one at w3.org)
checks the document as it is, not as it will/may be. All victimes of VP
(Validation Psychosis) syndrome do use this fact intensively to cheat
on validator. "Holly hacks" in CSS, <iframe> implantation over
scripting:- it is all to feed into validator a formally valid code
which vould be automatically deployed at runtime into non-so-valid but
functional version.

To check for markup errors client-side HTML Tidy does the trick. If it
is absolutely necessary to know what does W3C think about this code
/exactly/ and /at this given moment/ (as they change their mind rather
often) there is no option but eventually go to

<http://validator.w3.org/>
and
<http://jigsaw.w3.org/css-validator/>

May 17 '06 #6
VK wrote:
OP wanted something to not run after each change to w3.org This is what
has being said in the post I read and answered.
The OP explicity stated that (a) JavaScript was involved and (b) The
Firefox extension you suggested does not do the job.
I'm missing the point of this exersice. Of course using DOM methods and
even document.write I can bring the runtime document structure in the
state far away from what was originally presented to any validator. So
what's the point?
The point of validation is QA. Presumably the OP wants to maintain that
level of QA as the document is modified by client side scripting (so
that they can identify problems with their script).

Take for example a script which appends "<div><!-- a bunch of a
markup-->" to a document. Since the end tag for the div is missing,
interesting things can happen to the way the document is displayed -
being about to syntax check the generated markup would make it easier
to identify the problem.
Validator of any kind (including the one at w3.org)
checks the document as it is, not as it will/may be. All victimes of VP
(Validation Psychosis) syndrome do use this fact intensively to cheat
on validator. "Holly hacks" in CSS, <iframe> implantation over
scripting:- it is all to feed into validator a formally valid code
which vould be automatically deployed at runtime into non-so-valid but
functional version.
I've no idea what you mean by "<iframe> implantation over scripting",
but my understanding of the Holly Hack is to provide one set of CSS to
some browsers and a different set to others to work around problems
with one group of them - and nothing whatsoever to do with validation.
To check for markup errors client-side HTML Tidy does the trick. If it
is absolutely necessary to know what does W3C think about this code
/exactly/ and /at this given moment/ (as they change their mind rather
often) there is no option but eventually go to

<http://validator.w3.org/>
and
<http://jigsaw.w3.org/css-validator/>


Except that it is rather difficult to get hold of the markup as
modified by client side scripting.

May 17 '06 #7
VK

David Dorward wrote:
Except that it is rather difficult to get hold of the markup as
modified by client side scripting.
Not "difficult" but not possible, this is what I tried to explain.
Validator doesn't take some imaginary "DOM Tree timestamp" - it takes
raw code and sees if a valid DOM tree can be build out of it.

In theory I can imagine a "reverse engineered" validator which
1) uses a tree walker to get the exact DOM structure of the document at
this given moment.
2) Converts each found node to the relevant HTML representation (objDIV <div>)

3) Builds up a text document with "restored" HTML code
4) Submits this text document to some validator
5) Validator uses this code to build again DOM tree out of it and to
validate it.

Technically it is possible but AFAIK no one made yet such ridiculous
program (though once again technically it is possible).

May 17 '06 #8
VK wrote:
David Dorward wrote:
Except that it is rather difficult to get hold of the markup as
modified by client side scripting.


Not "difficult" but not possible


Really? So how does the ViewRenderedSource extension for Firefox get hold of
that then?

http://jennifermadden.com/scripts/Vi...redSource.html

From there it isn't a huge step to feeding it through nsgmls or similar.
In theory I can imagine a "reverse engineered" validator which
1) uses a tree walker to get the exact DOM structure of the document at
this given moment.
2) Converts each found node to the relevant HTML representation (objDIV
<div>) 3) Builds up a text document with "restored" HTML code
4) Submits this text document to some validator
5) Validator uses this code to build again DOM tree out of it and to
validate it.


Congratulations, you've just imagined the "impossible".
Technically it is possible but AFAIK no one made yet such ridiculous
program (though once again technically it is possible).


And it is ridiculous why? I've already explained the practical value of such
a tool.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
May 17 '06 #9
VK

David Dorward wrote:
Technically it is possible but AFAIK no one made yet such ridiculous
program (though once again technically it is possible).


And it is ridiculous why? I've already explained the practical value of such
a tool.


Ridiculous because where to use it? If one retrieves an entire document
over an ajaxoid, then use responseText for validation.

If one adds new elements over createElement/appendChild then on the
level of a single element validation is an over-kill. What ye going to
validate?
var d = document.createElement('DIV');
d.id = 'myDiv';
d.foo = 'bar';
validate(d); // ?

What's the point? You cannot decide yourselve? Also guess what: it is
perfectly valide element. Yes, I added 'foo' property to the DOM
interface, but as an HTML Element it is still perfectly valide
element, unlike if say I would do d.setAtribute('foo', 'bar'); thus if
I would change the DOM Node structure. In either case do you really
need a validator?

Probably it may get some use if one inserts a bounch of HTML mishmash
right into page over innerHTML. In this case maybe... Ridiculous tools
for ridiculous coding... :-)

May 18 '06 #10
VK wrote:
David Dorward wrote:
And it is ridiculous why? I've already explained the practical value of such
a tool.
Ridiculous because where to use it? If one retrieves an entire document
over an ajaxoid, then use responseText for validation.
If the document can change based on user input, then it may be
significantly easier to test it through a browser rather then construct
the HTTP requests through other methods.
If one adds new elements over createElement/appendChild then on the
level of a single element validation is an over-kill. What's the point? You cannot decide yourselve?
So everyone is perfect and never makes a mistake when writing/reviewing
code?

That's the point of validation - to catch errors that can be
overlooked.
Probably it may get some use if one inserts a bounch of HTML mishmash
right into page over innerHTML. In this case maybe... Ridiculous tools
for ridiculous coding... :-)


I haven't done any testing myself, but I'm told that performing updates
using innerHTML is a /lot/ faster then constructing the DOM piece by
piece.

May 18 '06 #11
David Dorward said the following on 5/18/2006 10:41 AM:
VK wrote:


<snip>
Probably it may get some use if one inserts a bounch of HTML mishmash
right into page over innerHTML. In this case maybe... Ridiculous tools
for ridiculous coding... :-)


I haven't done any testing myself, but I'm told that performing updates
using innerHTML is a /lot/ faster then constructing the DOM piece by
piece.


<URL:
http://groups.google.com/group/microsoft.public.scripting.jscript/browse_frm/thread/20fd1d2c0cdc25dc/883cb50317206917?q=removeChild+IE&rnum=1#883cb5031 7206917>

Is a thread where innerHTML is shown to be significantly faster at
modifying tables than the DOM methods are. I had always assumed the
opposite - with tables anyway - based on the MSDN article mentioned in
that thread but the code posted shows innerHTML to beat the DOM hands
down in those two cases.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 18 '06 #12
David Dorward wrote:
VK wrote:
Probably it may get some use if one inserts a bounch of HTML mishmash
right into page over innerHTML. In this case maybe... Ridiculous tools
for ridiculous coding... :-)


I haven't done any testing myself, but I'm told that performing updates
using innerHTML is a /lot/ faster then constructing the DOM piece by
piece.


It depends. As QuirksMode shows, innerHTML can be faster for tables.
However, faster is not necessarily better, since other factors have to
be taken into account, too. Such as interoperability.
PointedEars
May 22 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Akseli Mäki | last post by:
Hi, Hopefully this is not too much offtopic. I'm working on a FAQ. I want to make two versions of it, plain text and HTML. I'm looking for a tool that will make a plain text doc out of the...
38
by: Jukka K. Korpela | last post by:
As well all know, valid markup is important... but when trying to find a convincing modern argument in favor of this, I found pages like http://www.htmlhelp.com/tools/validator/reasons.html which...
195
by: Torbjørn Pettersen | last post by:
As you might have noticed I'm trying to clean up my web site's HTML code. The way I do it is simply more or less redoing to complete site, testing it on a web server I have set up on my local...
5
by: HchC | last post by:
Not looking for a special or fancy css stylesheet. For a HTML beginner, stylesheet is still far away from now. Not even said thinking about cross browser. But, an XHTML page without stylesheet look...
4
by: pcunix | last post by:
I'm looking for general advice, pointers to web pages, books, whatever. I have a moderately successful web site. The major complaint that I get, time after time, is "It's UUUGLY" As I have...
4
by: Michael Schuerig | last post by:
I'm working primarily on Linux with Konqueror. To Firefox I resort only for testing compatibility and when I need some feature from its Web Developer extension. Thus my perspective is probably...
40
by: VK | last post by:
Hi, After the response on my request from W3C I'm still unclear about Tidy vs. Validator discrepansies. That started with <IFRAME> issue, but there is more as I know. Anyway, this very basic...
78
by: Robert Baer | last post by:
The homepage i have had up and seemingly working is: http://oil4lessllc.com/ However, the validator has so many complaints, and being so incompetent, i have no clue as to how to fix it all. Would...
2
by: lorlarz | last post by:
Looking for feedback on Matching Exercises Maker/ Builder: http://mynichecomputing.com/ReadIt/translateT.html For one thing, I am concerned about storing the matching kwork (known word) as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.