Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Expressing relations between types

From: "Eric MALENFANT" <Eric.Malenfant@---------------.--->
To: <xmlschema-dev@--.--->
Date: 11/30/2007 5:23:00 AM
Consider an "Entry" type like this one:
  <xs:complexType name="Entry">
    <xs:sequence>
      <xs:element name="Received" type="xs:dateTime" />
      <xs:element name="Subject" type="xs:string" />
      <xs:element name="IsViewed" type="xs:boolean" />
      <xs:element name="Pages" type="xs:unsignedInt" />
    </xs:sequence>
  </xs:complexType>
  
Note that, in the real case, an Entry would have more elements that
this, 
all being of dateTime, string, boolean or unsignedInt types.  

A webservice method "findEntries" will return an array of Entry, based
on 
a filtering predicate passed in by its client. The "straightforward"
defintion
of such an EntryPredicate could be:
  <xs:complexType name="EntryPredicate">
    <xs:sequence>
      <xs:element minOccurs="0" name="Received" =
type="dateTimeRange" />
      <xs:element minOccurs="0" name="Subject:" type="xs:string" =
/>
      <xs:element minOccurs="0" name="IsViewed" type="xs:boolean" =
/>
      <xs:element minOccurs="0" name="Pages" =
type="unsignedIntRange" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="dateTimeRange">
    <xs:sequence>
      <xs:element minOccurs="0" name="Begin" type="xs:dateTime" />
      <xs:element minOccurs="0" name="End" type="xs:dateTime" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="unsignedIntRange">
    <xs:sequence>
      <xs:element name="Begin" type="xs:unsignedInt" />
      <xs:element name="End" type="xs:unsignedInt" />
    </xs:sequence>
  </xs:complexType>
  
For example, the client looking for unviewed entries having two Pages or
more
would pass in an EntryPredicate like:
  <EntryPredicate>
    <IsViewed>false</IsViewed>
    <Pages>
      <Begin>2</Begin>
    </Pages>    
  </EntryPredicate>
  
As you can see, the definition of EntryPredicate is closely tied to that
of Entry,
and it seems to me that there is a lot of repetition between Entry and
EntryPredicate.

I am thus wondering if there is a better way to define "related" types
like this.
For example, is there a way to express the definition of EntryPredicate
by saying
something like "this is the same thing than an Entry, replacing dateTime
by dateTimeRange,
unsingedInt by unsignedIntRange"?

In case this is not obvious: I have virtually no experience with XML
schemas,
so any pointers are appreciated.




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