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] Help with Schema

[ Lists Home | Date Index | Thread Index ]

David,

Please see comments below marked with [JMC].

Kind Regards,
Joe Chiusano
Booz | Allen | Hamilton


Wilson David wrote:
> 
> I am developing a schema and have come across several issues which I need some help with.
> 
> 1. For one of the elements valid data is defined by multiple number ranges, eg the value must be between 100000 and 399999 or be in the range 25 to 60. While I can define a single range using the mininclusive and maxinclusive tags as shown below, I need help with the multiple range problem.
> 
>         <xs:element name="Cost Code">
>                 <xs:simpleType>
>                         <xs:restriction base="xs:integer">
>                                 <xs:minInclusive value="100000"/>
>                                 <xs:maxInclusive value="399999"/>
>                         </xs:restriction>
>                 </xs:simpleType>
>         </xs:element>

[JMC] This can be done using union datatypes. The syntax is:

<simpleType name="name_of_type">
   <union memberTypes="name_of_first_type name_of_second_type"/>
</simpleType>

So you would have 2 "CostCodeType" datatypes - one for the first rage
("CostCodeTypeRange1") and one for the second range
("CostCodeTypeRange2"). These datatype names would be include in the
"memberTypes" attribute above.
 
> 2. One of the elements will have the format of two letters followed by eight digits (eg PP12345678). As shown below using Value="\i{2}\d{8}" works. However the value of the initial two letters within this string will come from a small defined list. The eight digits will come from one or more number ranges. I am not sure how to incorporate this into the schema.

[JMC] Ranges in regular expressions are expressed in the format [X-Y] -
please reference http://www.w3.org/TR/xmlschema-2/#regexs for more info.

("CostCodeTypeRange1") 
>         <xs:element name="Asset Number">
>                 <xs:simpleType>
>                         <xs:restriction base="xs:string">
>                                 <xs:pattern value="\i{2}\d{8}"/>
>                         </xs:restriction>
>                 </xs:simpleType>
>         </xs:element>
> 
> 3. Two elements within the schema have an either / or relationship. A valid XML document can contain only one of these elements, not both. How can this be reflected in a schema?

[JMC] This can be done with the <choice> compositor:

<xs:choice>
   <xs:element name="name_of_first_element"
type="type_of_first_element"/>
   <xs:element name="name_of_second_element"
type="type_of_second_element"/>
</xs:choice>

> If this is not the appropriate forum for questions of this type I would be grateful if you could point me in the right direction.
> 
> Thanks
> 
> David
> --------------------------------------------------------------------------------------------------------------------------
> IMPORTANT: This email (including any attachments) may contain confidential,
> private or legally privileged information and may be protected by copyright. You may
> only use it if you are the person(s) it was intended to be sent to and if you use it in an
> authorised way. No one is allowed to use, review, alter, transmit, disclose, distribute,
> print or copy this e-mail without appropriate authority.
> 
> If this e-mail was not intended for you and was sent to you by mistake, please
> telephone or e-mail me immediately, destroy any hard copies of this e-mail and delete
> it and any copies of it from your computer system. Any legal privilege and
> confidentiality attached to this e-mail is not waived or destroyed by that mistake.
> 
> It is your responsibility to ensure that this e-mail does not contain and is not affected
> by computer viruses, defects or interference by third parties or replication problems
> (including incompatibility with your computer system).
> 
> -----------------------------------------------------------------
> 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>
begin:vcard 
n:Chiusano;Joseph
tel;work:(703) 902-6923
x-mozilla-html:FALSE
url:www.bah.com
org:Booz | Allen | Hamilton;IT Digital Strategies Team
adr:;;8283 Greensboro Drive;McLean;VA;22012;
version:2.1
email;internet:chiusano_joseph@bah.com
title:Senior Consultant
fn:Joseph M. Chiusano
end:vcard

  • References:



 

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

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