Converting XSD into DTD?

M

Michael Wein

Hello,

does anyone know of a way/solution how to convert XML Schema documents into
DTD? I am aware of the fact that such a conversion won't be possible under
certain circumstances and that probably some information loss will occur
(esp. data types). However, in many cases it should be possible to obtain
at least the structure of the XSD.

Any help would be greatly appreciated. Thanks in advance.
 
D

Dirk Segelhorst

Michael said:
does anyone know of a way/solution how to convert XML Schema documents into
DTD? I am aware of the fact that such a conversion won't be possible under
certain circumstances and that probably some information loss will occur
(esp. data types). However, in many cases it should be possible to obtain
at least the structure of the XSD.

Hi Michael,

XMLSpy 2004 supports the conversion between XSD and DTD (Menu:
"DTD/Schema"->"Convert DTD/Schema...").

HTH,

Dirk
 
M

Michael Wein

XMLSpy 2004 supports the conversion between XSD and DTD (Menu:
"DTD/Schema"->"Convert DTD/Schema...").

Hi Dirk,

thank you for the quick reply. But as we don't have XML Spy at hand we have
to look for a different solution.
 
M

Michael Wein

perhaps you give the W3C dtd2xsd conversion tool a try:
http://www.w3.org/2000/04/schema_hack/

It is free, but I do not know if it is as mighty as the XMLSpy conversion.

Well, it is actually for the wrong direction -- as fas as I can see, it
converts DTD into XSD. For that purpose there exist several other (free)
tools (e.g. Syntext's dtd2xs).

In the mean time I found dtd2xsd.xsl
(http://crism.maden.org/consulting/pub/xsl/xsd2dtd.xsl), a simple style
sheet. We will have a closer look at it.
 
D

Dirk Segelhorst

Michael said:
Well, it is actually for the wrong direction

Sorry... I had a too fast look at it ;o) Just had it in my bookmarks.

Why don't you parse the XSD and generate the DTD yourself? Should not be
too hard if you use an XSD Object Model (have a look at the XSD part of
Xerces or the XSD Tool in Eclipse).

Dirk.
 
M

Michael Wein

XMLSpy 2004 supports the conversion between XSD and DTD (Menu:
"DTD/Schema"->"Convert DTD/Schema...").

Just downloaded XML Spy and tried that "feature". The DTD generated is
completely useless (not to say: crap). E.g. it generated !ATTLIST for
complex types!? I fear that won't work. :-(
 
M

Michael Wein

Just downloaded XML Spy and tried that "feature". The DTD generated is
completely useless (not to say: crap). E.g. it generated !ATTLIST for
complex types!? I fear that won't work. :-(

Small correction: As I figured out, XML Spy simply generates a DTD for the
given XML file -- it completely ignores that the XML acutally is a schema
definition. So here we are at the wrong meta level ;-)
 
D

Dirk Segelhorst

Michael said:
Small correction: As I figured out, XML Spy simply generates a DTD for the
given XML file -- it completely ignores that the XML acutally is a schema
definition. So here we are at the wrong meta level ;-)

Which XMLSpy version do you use? Trying the same with XMLSpy 2004
Enterprise Edition works fine for my schema! And it really generated the
DTD from schema and not from XML.

Dirk.
 
M

Michael Wein

Which XMLSpy version do you use? Trying the same with XMLSpy 2004
Enterprise Edition works fine for my schema! And it really generated the
DTD from schema and not from XML.

Just one more correction: I must apologize for not following your advice
correctly. Instead of converting the schema the way you proposed I chose
"generate" schema what, of course, led to the wrong result. No looking
closer and *converting* the schema into a DTD seems to be successfull!
Thank you very much, this will be a good start for us.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top