OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] DSDL part 9: new namespace declarations not needed

[ Lists Home | Date Index | Thread Index ]

This *does* look really nice - very concise, and easy to understand. I 
hadn't looked at the compact format for RELAX NG before. Okay, I'll sign 
up for replacing DTDs with RELAX NG, especially when/if the compact 
syntax can be used interchangably with the XML version.

As for the validation issue, I see a lot of applications using XML and 
very few of them use parser validation in normal operation. In some 
cases I wish they would - too many applications silently ignore portions 
of a document when it doesn't match what they're expecting. This is 
often the case with SAX-based applications, since the event-driven 
interface tends to encourage ordering assumptions in the code while 
requiring extra effort to check that the assumptions are met. I see pull 
parser interfaces as a big step forward here because they allow you to 
make use of structure information in your code while simultaneously 
making it easy to check that the document matches your expectations.

Incidentally, the whole approach to validating documents currently used 
by most parsers (get a document, find and parse the schema, interpret 
the schema against the document to validate) seems kind of bizarre to 
me. It's very inefficient, and it also creates the opportunity for 
disaster from changing the schema without changing the program to match 
("the schema is not the application", to coin a paraphrase...). 
Techniques that integrate the schema validation into the application 
(such as some of the data binding frameworks) seem much more robust in 
this respect.

  - Dennis

John Cowan wrote:

>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.)
>  
>






 

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

Copyright 2001 XML.org. This site is hosted by OASIS