Just off the top of my head, removing the ugly “]>” at the top of documents with internal subsets can be done with a little [removed]
with (document.body) for (var i=0;i<2;++i) if (/]>/.test(childNodes[ i ].data))removeChild(childNodes[ i ]);
Of course, it’s not ideal, but seems to do the job. It loops over the first two elements since different browsers place the characters in different positions. Originally I thought to simply strip the first two body child nodes, but realized that’s more prone to worst-case scenarios.
The script can even be placed in the head tags without being attached to an onload event, since it depends on contents that’re already parsed. Should remove the node as soon as it hits the script.
Why go through all this trouble of creating custom stuff? Is your client really ready to pay for all this? Is it justified over time? Will the site structure stay the same long enough for this to work? I think for smaller websites this takes way to much time.
So where can I find a module, library or app that will take some of my database schemas from my content manglement system and generate a valid DTD so I don’t shoot my food clean off (something a bit … well alot less expensive than XMLSpy ya’know) ?
25 Reader Comments
Back to the ArticlePubso
Try to validate this site: http://bednarz.nl Link to validatation: http://validator.w3.org/check?uri=http://bednarz.nl/
Funny isnt it?
Dan O'Brien
Hey,
Just off the top of my head, removing the ugly “]>” at the top of documents with internal subsets can be done with a little [removed]
with (document.body) for (var i=0;i<2;++i) if (/]>/.test(childNodes[ i ].data))removeChild(childNodes[ i ]);
Of course, it’s not ideal, but seems to do the job. It loops over the first two elements since different browsers place the characters in different positions. Originally I thought to simply strip the first two body child nodes, but realized that’s more prone to worst-case scenarios.
The script can even be placed in the head tags without being attached to an onload event, since it depends on contents that’re already parsed. Should remove the node as soon as it hits the script.
Yves Peeters
Why go through all this trouble of creating custom stuff? Is your client really ready to pay for all this? Is it justified over time? Will the site structure stay the same long enough for this to work? I think for smaller websites this takes way to much time.
Do like the idea though
Peter McEvoy
I’m confused? Why not use attributes in a different namespace? EG:
<input type=“text” name=“yourName” myns:required=“true” />
That way you aren’t touching the XHTML DTDs at all…
Mean Dean
So where can I find a module, library or app that will take some of my database schemas from my content manglement system and generate a valid DTD so I don’t shoot my food clean off (something a bit … well alot less expensive than XMLSpy ya’know) ?