XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] Use DTDs!

>> Dan Connolly pioneered a simple approach 
>> using parameter entities, see e.g.
>> 
>>  https://www.w3.org/2001/XMLSchema.dtd
 
> And that's not cumbersome?

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


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS