Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML Design

From: "Joe Fawcett" <joefawcett@---------.------>
To: NULL
Date: 7/1/2008 9:45:00 AM

That looks okay although schemas are not my strong suit.
I do believe you need minOccurs="0" and maxOccurs="unbounded" on <xs:element 
name="risk" type="riskType" />
(If there must be one risk the you can omit the minOccurs attribute.)

-- 

Joe Fawcett (MVP - XML)

http://joe.fawcett.name


"Adam David Moss" <no@e...> wrote in message 
news:O$a1shv2IHA.2332@T......
> Ok,
>
> So working on the advice so far I've come up with:
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <xs:schema elementFormDefault="qualified" 
> targetNamespace="http://www.anurl.com" version="1.0" 
> xmlns="http://www.anurl.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>  <xs:element name="risk" type="risksType" />
>
>  <xs:complexType name="risksType">
>    <xs:sequence>
>      <xs:element name="risk" type="riskType" />
>    </xs:sequence>
>  </xs:complexType>
>
>  <xs:complexType name="riskType">
>    <xs:sequence>
>      <xs:element name="description" type="xs:string" />
>      <xs:element name="response" type="responseType" />
>    </xs:sequence>
>
>    <xs:attribute name="severity">
>      <xs:simpleType>
>        <xs:restriction base="xs:string">
>          <xs:enumeration value="Low" />
>          <xs:enumeration value="Moderate" />
>          <xs:enumeration value="Substantial" />
>          <xs:enumeration value="Severe" />
>          <xs:enumeration value="Critical" />
>        </xs:restriction>
>      </xs:simpleType>
>    </xs:attribute>
>
>    <xs:attribute name="effectiveDate" type="xs:date" />
>  </xs:complexType>
>
>  <xs:complexType name="responseType">
>    <xs:sequence>
>      <xs:element name="description" type="xs:string" />
>    </xs:sequence>
>
>    <xs:attribute name="severity">
>      <xs:simpleType>
>        <xs:restriction base="xs:string">
>          <xs:enumeration value="Normal" />
>          <xs:enumeration value="Heightened" />
>          <xs:enumeration value="Exceptional" />
>        </xs:restriction>
>      </xs:simpleType>
>    </xs:attribute>
>  </xs:complexType>
> </xs:schema>
>
> Is this the correct way to lay this out or have I missed something?
>
> Many thanks.
>
>
> "Peter Flynn" <peter.nosp@m...> wrote in message 
> news:6cqgadF3fal8pU1@m......
>> Joe Fawcett wrote:
>>> I just think attributes are better for meta-data and single values. The
>>> only reason that I'd put description as a text node is that long text
>>> values are unwieldy in attribute values.
>>
>> I'd agree with Joe (and see
>> http://xml.silmaril.ie/developers/attributes/). I also favour terseness,
>> no matter what the Spec suggests :-) I'm really not convinced of the
>> need to repeat the locus as a prefix on every element type name:
>> redundancy is all very well, but it makes the file very cluttered.
>>
>> <risks>
>> <risk severity="low" effective="yyyy-mm-dd">
>>   <description></description>
>>   <response severity="high">
>>     <description></description>
>>   </response>
>> <risk>
>> ...
>> </risks>
>>
>> This also means you only have to define description once.
>>
>>> It's not something I'd get into a fight over though :)
>>
>> No, but it's the kind of thing that leads to long sessions in the pub at
>> XML conferences :-)
>>
>> ///Peter
>>
> 




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