p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XML (http://p2p.wrox.com/forumdisplay.php?f=91)
-   -   Convert DTD to Schema (http://p2p.wrox.com/showthread.php?t=55780)

bcogney March 23rd, 2007 03:19 PM

Convert DTD to Schema
I am in the process of converting our companies DTD to a Schema, I was asked to put a plan of convincing reasons to convert to Schema.
Here is what I know about our application, it doesn't support namespaces. Would that limit the use of a Schema? Also, what benefits are we missing for leaving namespaces not supported?


mhkay March 23rd, 2007 03:45 PM

The benefits of moving to schema depend on what you want to do with them. If you only need to do the things that you can do with DTDs then the benefits are not great: the main ones are that there are probably now more tools and skills available. The main things that you can do with schemas that you can't do with DTDs are (a) validate the content as well as the structure of the document, (b) define mappings ("data binding") to languages such as Java, (c) do strongly-typed (and therefore more robust) XSLT and XQuery, (d) control exactly when validation takes place and which schema to use for validation, (e) make better use of namespaces.

You can use schemas without using namespaces, but if you do use namespaces then schemas are much better than DTDs because DTDs aren't namespace-aware.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

bcogney March 23rd, 2007 06:24 PM

It's interesting how the use of a DTD or Schema depends on what you need to do with them. My main reason was to keep the company (and myself) up to date with the current XML related technologies.
Can you please let me know what you think about not using namespaces, and what benefits namespaces would do for our application. I'll tell you a little bit about our application, we display digital books marked up in XML.

joefawcett March 24th, 2007 02:42 AM

If you're only going to use a schema internally, and not use it in conjuction with another schema, for instance where you have the book schema as part of a library that also has schema for CDs etc, then not using namespaces will probably not be a problem, although you will find less support from editing tools in this case.
The main use of namespaces is to differentiate elements with a similar local name, e.g a table in a book and a table in a furniture store, to take a silly example. The namespace acts to separate these so that they can be processed separately, by XSLT for example.


Joe (Microsoft MVP - XML)

bonekrusher March 24th, 2007 08:01 AM

Joe, in your opinion do you think DTDs are being phased out?


joefawcett March 24th, 2007 08:45 AM

Most people seem to be choosing XML Schemas over DTDs but there are still an awful lot of DTDs around that will probably never be converted. There are alos a few things DTDs do that schemas cannot, like declaring entity references.


Joe (Microsoft MVP - XML)

bonekrusher March 24th, 2007 09:05 AM

Thats true. But rather than declaring entity references you can use the doc() to bring in external content?

I will admit I know very lillt about DTD's but they seem very very complicated when there are many external references...


mhkay March 25th, 2007 06:39 PM

Namespaces start to become useful when you are dealing with many different XML vocabularies especially if they are designed by different teams or organizations; they are especially useful when you are sharing XML with other organizations and need to have formal change control over the design. So a lot depends on how you expect your application to grow.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

All times are GMT -4. The time now is 08:23 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.