> I am a novice to XML and just started with it. The one question which always come to me is :
> Why do we need the well formed documents when a DTD associated with the document can provide us better insight about the content of
Even with a DTD your document still has to be well-formed. "Well-formed"
and "valid" are not alternatives.
> the document. I suppose that just to reduce the network traffic. But can't we do it as follows :
> 1) Every document is associated with its DTD
> 2) The client has in its repository all the commonly used DTDs in the parsed form.
> 3) Client wants to access a document on the web which has some DTD associated with it.
> 4) Client browser sees that the associated DTD is lying locally in the parsed format. It just downloads the document instance and
> opens it if it found to be confirming with its DTD.
> 5) If client access any such document whose DTD is not available locally, then it will also download the DTD, parse it and store it
> into its repository for using it later when accessing similar document types.
This is pretty much what existing SGML browsers have been doing for
years (although the DTDs were kept in their plain text format). It's
exactly what I'd expect a sensible browser to do for SGML, but with XML
I suspect there won't be "commonly used DTDs" for quite a while
(although DocBook, HTML, and TEI are obviously going to be well
used). Most commercial applications (non-text apps) are going to use
custom or on-the-fly DTDs, so unless the browser caches everything just
to be sure, the most likely scenario is download the DTD each time.
> Won't this proposal be much better then using documents with no DTDs attached with them. Correct me if i have made some wrong
There will be lots of cases where the DTD will change with each instance,
because it's only there to allow the stylesheet some hooks to hang formatting