Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XML Design [Thread Next] Re: XML DesignTo: 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 >> > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
