Hi all,
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
Hi all,
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
Here is something I found that might be of use: http://www.hitsw.com/xml_utilites/
There is also a class that appears to be promising: http://phpclasses.2by2host.com/browse/package/250.html
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) :
DTDGenerator is a program that takes an XML document as input and produces a Document Type Definition (DTD) as output.
The aim of the program is to give you a quick start in writing a DTD.
The DTD is one of the many possible DTDs to which the input document conforms.
Typically you will want to examine the DTD and edit it to describe your intended documents more precisely.
A couple of nice things about this DTDGenerator
program 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 DTDGenerator
before starting is that its author already thought about this process -- and already identified some situations that you might not think about ;-)