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

Re: DSDL part 9: new namespace declarations not needed

  • To: dms@s... (Dennis Sosnoski)
  • Subject: Re: DSDL part 9: new namespace declarations not needed
  • From: John Cowan <jcowan@r...>
  • Date: Mon, 17 Jun 2002 08:45:35 -0400 (EDT)
  • Cc: xml-dev@l...
  • In-reply-to: <3D0C4CBC.9020103@s...> from "Dennis Sosnoski" at Jun 16, 2002 01:30:52 AM

Re:  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@r...>     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_

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.