Is it possible to define which element will be the root element in a DTD internally. In other words, Is it possible to define the root element when DTD is in a separate file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The root element is determined by the
DOCTYPEdeclaration. The root element can be any element in the DTD.For example in the DTD below (test.dtd),
bookwould normally be the root element:However, if we use
sectionin the doctype,sectionis the root element:I’ve used
DOCTYPEdeclarations in the external DTD to directly specify the root element, but I don’t think that is allowed by the spec. What I did was keep theDOCTYPEin the external DTD and remove theDOCTYPEfrom the XML file. I was able to associate the DTD with the XML file on the command line of the program I was using.