Re: Generating a DTD from XML files?
> Does anyone know a utility or package to generate a basic DTD from XML > files? >>> XML Spy and many other packages will do this for you, however, you will have to edit the DTD by hand afterwards to fix cardinality rules. There is no way that an automated process could establish whether or not you wanted to allow multiple instances of a certain element when only one instance is present in your document. Also, enumerations for attribute values are impossible for an automated process to properly declare. If your source XML document has a structure like this: <price currency="USD"/> All it could determine is the present value and write out a DTD declaration like such: <!ELEMENT price (#PCDATA)> <!ATTLIST price currency CDATA #REQUIRED> It cannot write out whether the value for "currency" is #REQUIRED or #IMPLIED or #FIXED. It also could not tell you that additional values are allowed, what the dafault should be and that only those values are allowed like this: <!ATTLIST price currency (USD | CAD | AUS) "USD" #REQUIRED> Best advice: text editor + old school methods ;-) Cheers Duane Nickull CTO, XML Global Technologies http://www.xmlglobal.com
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format