Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML Schemas patterns (was: Re: Defining recursive elements?)

From: noah_mendelsohn@--.---.---
To: "Pete Cordell" <petexmldev@--------------.--->
Date: 5/17/2007 2:54:00 PM
Pete Cordell writes:

> I often see things like:
> 
>   <element name="thing">
>     <sequence>
>         <element name="height" type="measurementType"/>
>         <element name="width" type="measurementType"/>
>     </sequence>
>   </element>
> 
> <complexType name="measurementType">
>     <simpleContent>
>         <extension base="float">
>             <attribute name="units" type="string"/>
>         </extension>...
> 
> To me, this results in a lot of duplication if everything is to be made 
> global.

Let's see:

  <element name="thing">
    <sequence>
        <element ref="height"/>
        <element ref="width"/>
    </sequence>
  </element>

  <element name="height" type="measurementType"/>
  <element name="width" type="measurementType"/>
  <complexType name="measurementType">
    <simpleContent>
        <extension base="float">
            <attribute name="units" type="string"/>
        </extension>...

I don't see a whole lot of duplication.  Like the type, the elements are 
declared in one place and used in another.  Of course, there would be more 
payoff on that if it turned out that widths or heights were also needed 
outside of "things".

> I think it would also be harder to read as you would see the 
> local ref to height and then have to find the global definition
> (which could be a long way away) to find out what it's type is.

Yes.  I acknowledged that the syntax of Schema 1.0 facilitates the use of 
locals vs. globals, and suggested that to be unfortunate.  I would have 
seriously considered having the syntax of your original be interpreted to 
define a global, I.e. to do some sort of folding so that what were 
syntactically duplicate (for some definition of duplicate) element 
declarations would be folded into a single global, with differences 
allowed only if some other syntax or "local" switch were thrown.  As it 
stands, the local syntax is indeed more convenient, as I said in my note.

For the reasons Michael Kay's been giving, plus the one's I've been 
contributing, I think that the >semantics< of globals are usually 
preferable, and I don't think you've given any examples to indicate to the 
contrary.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------





From aureliocalegari@h... Fri May 18 02:18:53 2007
Received: from wiggum.w3.org ([128.30.52.23])
	by frink.w3.org 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent