ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-dev
xml-dev
Re: [xml-dev] DSDL part 9: new namespace declarations not needed
by John Cowan other posts by this author
Jun 17 2002 12:45PM messages near this date
Re: [xml-dev] DSDL part 9: new namespace declarations not needed as part of DTD syntax? | Re: [xml-dev] DSDL part 9: new namespace declarations not needed
Dennis Sosnoski scripsit:

>  Simplicity and terseness are at the top of my list. The only real 
>  problem with using DTDs now is Namespaces. The non-XML format is a pain, 
>  but less so than the verbosity and complexity of Schemas. DTDs are 
>  simple enough that they don't really require any special tools, in my 
>  experience; Schemas do.

How does this suit you?

##    Simplified purchase order schema for Example.com.
##    Copyright 2002 Example.com. All rights reserved.

start = element purchaseOrder { purchaseOrderType }

comment = element comment { text }

purchaseOrderType =
        element shipTo { USAddress },
        element billTo { USAddress },
        comment?,
        element items { Items },
        attribute orderDate { text }

USAddress =
        element name { text },
        element street { text },
        element city { text },
        element state { text },
        element zip { xsd:decimal },
        attribute country { xsd:NMTOKEN "US" }

Items =
        element item {
                element productName { text },
                element quantity {
                        xsd:positiveInteger params { maxExclusive = "100" }
                        },
                element USPrice { xsd:decimal },
                comment?,
                element shipDate { xsd:date },
                attribute partNum { SKU }
                }

## Stock Keeping Unit, a code for identifying products --> 
SKU = xsd:string params { pattern = "d{3}-[A-Z]{2}" }

(This schema slavishly imitates the one in XS-0, and is not an example
of my personal style.)

>  Familiarity is certainly a part of this. I strongly suspect, though, 
>  that given equal time spent on both most users would be able to work 
>  with DTDs far more reliably and confidently than with Schemas.

Quite likely true, since DTDs have fewer things to learn about.
As a result, one can go more deeply into each feature in a given time.

>  Rudimentary validation support makes sense to me as a developer using 
>  XML (basically what's provided by DTDs, element and attribute names, 
>  nesting, and ordering). Going beyond that is redundant to my application 
>  code, which means that either I'll ignore the extra validation features 
>  or will just turn off validation in the parse.

Okay, here's a stripped-down version of the above with no datatypes:

start = element purchaseOrder { purchaseOrderType }

comment = element comment { text }

purchaseOrderType =
        element shipTo { USAddress },
        element billTo { USAddress }
        comment?,
        element items { Items },
        attribute orderDate { text }

USAddress =
        element name { text },
        element street { text },
        element city { text },
        element state { text },
        element zip { text },
        attribute country { "US" }

Items =
        element item {
                element productName { text },
                element quantity { text },
                element USPrice { text },
                comment?,
                element shipDate { text },
                attribute partNum { text }
                }

>  My main argument is just that validation through Schema or any of the 
>  alternatives does not eliminate the need for a consciencious developer 
>  to verify the data as received by the application - and if you're doing 
>  this, why have the parser run a subset of the same checks?

Well, there is verifying and there is verifying.  Why bother to program
checks in full generality using procedural code if you can partially
express them in declarative language?  The same applies to structural
checks, after all: do you write code when processing an element to
verify that it has correct parents and children, or do you rely on the
declarative validation?  It's all in where you draw the line.

>  Now I see Schema as the reincarnation of Ada (my apologies to 
>  any Ada fans on the list, but I went through much the same experience 
>  with that initiative at the time it came out) - elegant in a way, but 
>  far too complex to be appealing.

On this analogy, RELAX NG is Scheme.

>  Join the DTD Underground! The Evil Elitist Schema Empire will be Crushed 
>  by the Indifference of the Uprisen Masses of the Developer Proletariat! 
>  We Shall Overcome!!!

Having fought the good fight for DTDs, fight the better fight for RELAX NG.

>  Or not...  ;-)

The people united can never be defeated.

-- 
John Cowan <jcowan@[...].com>      http://www.reutershealth.com
I amar prestar aen, han mathon ne nen,    http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith.  --Galadriel, _LOTR:FOTR_

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org> , an
initiative of OASIS <http://www.oasis-open.org> 

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl> 
Thread:
John Cowan
Marcus Carr
Eric Bohlman
Marcus Carr
james anderson
james anderson
james anderson
Marcus Carr
Arjun Ray
Marcus Carr
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Deborah Aleyne Lapeyre
John Cowan
Thomas B. Passin
Ronald Bourret
Ronald Bourret
Michael Kay
Thomas B. Passin
james anderson
David Carlisle
james anderson
David Carlisle
james anderson
David Carlisle
james anderson
Michael Kay
james anderson
David Carlisle
Tim Bray
Ronald Bourret
Ronald Bourret
Ronald Bourret
Arjun Ray
John Cowan
Arjun Ray
John Cowan
Arjun Ray
John Cowan
John Cowan
james anderson
John Cowan
Rick Jelliffe
Arjun Ray
John Cowan
Rick Jelliffe
Rick Jelliffe
Dennis Sosnoski
John Cowan
Dennis Sosnoski
John Cowan
Dennis Sosnoski
Arjun Ray
G. Ken Holman
John Cowan
Arjun Ray
james anderson
Arjun Ray
John Cowan
Arjun Ray
Rick Jelliffe
John Cowan
Arjun Ray
John Cowan
John Cowan
james anderson
John Cowan
james anderson
james anderson
John Cowan
james anderson
james anderson
John Cowan
Ronald Bourret
Ronald Bourret
Jonathan Borden
Ronald Bourret
Michael Fuller
John Cowan
Bob Hutchison
james anderson
Thomas B. Passin
John Cowan
Ronald Bourret
John Cowan
Thomas B. Passin
Ronald Bourret
Ronald Bourret
james anderson
Norman Walsh
K. Ari Krupnikov
John Cowan
John Cowan
K. Ari Krupnikov
John Cowan
G. Ken Holman
Ronald Bourret
Rick Jelliffe
John Cowan
Marcus Carr
G. Ken Holman
John Cowan
Michael Fitzgerald
Paul Prescod
John Cowan
John Cowan

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved