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

RE: Use DTDs!

  • From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
  • To: "Costello, Roger L." <costello@mitre.org>,"xml-dev@l..." <xml-dev@l...>
  • Date: Mon, 02 May 2016 09:42:12 -0400

RE:  Use DTDs!
In ISO/IEC 19757-2 RELAX-NG Compact Syntax:

element altitude { attribute units { 'feet' | 'meters' }, text }

At 2016-05-02 11:49 +0000, Costello, Roger L. wrote:
Compare DTDs and XSDs for this simple example:

An element, altitude, with an attribute,
units whose value is restricted to feet
or meters:


Altitude.dtd
--------------------------------------------------------
<!ELEMENT altitude (#PCDATA)>

<!ATTLIST altitude
units (feet|meters) #REQUIRED>
--------------------------------------------------------


Altitude.xsd
--------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:element name="altitude">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="units" use="required">
<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="feet" />

<xs:enumeration value="meters" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>

</xs:schema>
--------------------------------------------------------

DTD: 3 lines
XSD: 21 lines

DTD: easy to understand
XSD: impossible to understand without deep knowledge of XSDs

DTD: simple problem, simple solution
XSD: simple problem, difficult solution

/Roger

--
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training @US$45: http://goo.gl/Dd9qBK |
Crane Softwrights Ltd. _ _ _ _ _ _ http://www.CraneSoftwrights.com/x/ |
G Ken Holman _ _ _ _ _ _ _ _ _ _ mailto:gkholman@CraneSoftwrights.com |
Google+ blog _ _ _ _ _ http://plus.google.com/+GKenHolman-Crane/posts |
Legal business disclaimers: _ _ http://www.CraneSoftwrights.com/legal |


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.