[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Generating a DTD from XML files?

  • From: Duane Nickull <duane@x...>
  • To: Rob Lawson <rob.lawson@k...>, xml-dev@l...
  • Date: Thu, 17 May 2001 02:45:28 -0700

generate dtd from xml
> 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



Duane Nickull
CTO, XML Global Technologies


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.