How do you go about developing an application?

Where does the DTD go?

  • For the web developers in the house: when viewing the generated code for a web page, the Document Type Definition is missing. Where does it go? I'm developing a web application for browsing network device information (on routers, switches, wireless APs, etc.). In debugging a jQuery problem in IE7, I was looking at the app's generated code, the source code after JavaScript has built the page and Ajax has populated it with data from a JSON object. So, long story short: in the generated code of this app and then in every other site I visited (in IE, Firefox, Safari), the Document Type Definition was missing--just gone (inspect the HTML for MeFi with Firebug and you'll see what I mean). Where does the DTD go? and why? Any ideas?

  • Answer:

    Well it's not really part of the markup, it specifies what type of markup is to follow, and so doesn't fit into the DOM tree. So it does make sense that Firebug doesn't try to display it as part of the expandable tag hierarchy.

josephtate at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Wait, you're saying that when you view-source on ANY page on the internet using ANY browser, the doctype is missing? I see malevolent's point about it being outside the DOM tree, but you say this happens on IE and safari as well, yes? so presumably in those browsers you are not looking at the DOM, you are looking at the page source? If you view-source (Ctrl-U) on this page, what is the first line of HTML that you see?

misterbrandt

Oh sorry, you're just talking about generated source. Yeah, I think malevolent has it -- it is an instruction to the browser as to which parsing engine to use, but it is not itself an element, and can't be manipulated or accessed via the DOM.

misterbrandt

View source shows the DTD to me just fine on any website that's well-behaved enough to HAVE a DTD. DOM interpreters, like Firebug and the slew of others, don't have it -- because as malevolent and misterbrandt say, it's not part of the DOM.

delfuego

Great, thanks for the input. This answers it for me.

josephtate

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.