Is there any PHP script to convert XML file to DTD.
I tried a lot. I can able to find tools but can’t PHP script.
Is there any?
any help will be thankful…
Fero
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.
Generating a DTD from an XML file is something I’ve not seen done quite often — one of the main reasons being that you cannot be sure the XML file you used to generate the DTD will contain everything that the DTD should define.
i.e. the generated DTD will only contain the elements and attributes that were present in that specific XML file — which doesn’t necessarily means all elements and attributes that should be accepted when using it later.
That being said, I haven’t found any PHP tool to create a DTD from an XML file…
… But I’ve found a JAVA one : DTDGenerator – A tool to generate XML DTDs (quoting) :
A couple of nice things about this
DTDGeneratorprogram are :Starting from that program’s source code, it should be possible to write some PHP code (if you cannot execute JAVA, and really need this to be written in PHP) to do the same thing : the basic ideas are not that hard :
Nice thing of taking a look at this
DTDGeneratorbefore starting is that its author already thought about this process — and already identified some situations that you might not think about 😉