OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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