Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Root element specified by DTD ? >Thread Next - Re: Root element specified by DTD ? Re: Root element specified by DTD ?To: NULL Date: 6/3/2006 12:18:00 PM In article <1149239813.134006.175360@i...>, "Andy Dingley <dingbat@c...>" <dingbat@c...> wrote: > My question is, is there any way to author a non-HTML DTD (SGML or XML) > so as to restrict valid documents to only allow a certain subset of > their elements to be used as the root element? Can this restriction be > expressed _entirely_ within a DTD? No and no. RELAX NG can restrict the allowed roots and does not allow the document to override. > Is this fragment a valid HTML document ? > <!DOCTYPE div PUBLIC "-//W3C//DTD HTML 4.01//EN" > "http://www.w3.org/TR/html4/strict.dtd"> > <div> > <p>Foo</p> > </div> Valid in the SGML sense but not conforming to the HTML 4.01 spec. Validity is overrated. DTD-validity is especially overrated. > Good tutorial refs on DTDs are also welcome. I don't know anything like > enough on DTD innards. Since you haven't learning invested in DTDs, unless you have a non-negotiable requirement to use them, I suggest learning RELAX NG Compact Syntax instead: http://relaxng.org/compact-tutorial-20030326.html -- Henri Sivonen hsivonen@i... http://hsivonen.iki.fi/ Validation Service for RELAX NG: http://hsivonen.iki.fi/validator/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
