- From: Don Box <dbox@microsoft.com>
- Date: Mon, 10 Mar 2003 14:10:45 -0800
- To: "Amelia A. Lewis" <alewis@tibco.com>, "John J. Barton" <John_Barton@hpl.hp.com>
- Cc: <anne@manes.net>, <xml-dist-app@w3.org>
> -----Original Message----- > From: Amelia A. Lewis [mailto:alewis@tibco.com] > Sent: Monday, March 10, 2003 1:45 PM > To: John J. Barton > Cc: Don Box; anne@manes.net; xml-dist-app@w3.org > > <xs:schema> > <xs:complexType name="mimeType"> > <xs:simpleContent> > <xs:extension base="xs:base64Binary"> > <xs:attribute name="content-length" type="integer" use="required" > /> > <xs:attribute name="content-type" type="mimeContentType" > use="required" /> > <xs:anyAttribute namespace="##other" processContents="lax" /> > </xs:extension> > </xs:simpleContent> > </xs:complexType> > > <xs:simpleType name="mimeContentType"> > <xs:restriction base="xs:string"> > <xs:pattern value="(text|image|application|audio|video|model|x- > .+)/.+" /> > </xs:restriction> > </xs:simpleType> > </xs:schema> > > Doesn't allow composite types, of course. Or make it simpler still, with > .+/.+, but new types are (by design) rare, while sub-types are relatively > easy. Add more headers with namespaced attributes. This makes processing > pretty straightforward (more so than plain base64, because this provides > both a content type and a content length). If it thrills you, you then > get this: > > <xs:complexType name="mimeCompositeType"> > <xs:complexContent> > <xs:choice minOccurs="1" maxOccurs="unbounded"> > <xs:element name="simplePart" type="mimeType" /> > <xs:element name="complexPart" type="mimeCompositeType" /> > </xs:choice> > <xs:attribute name="content-type" type="mimeCompositeContentType" > use="required" /> > </xs:complexContent> > </xs:complexType> > > <xs:simpleType name="mimeCompositeContentType"> > <xs:restriction base="xs:string"> > <xs:pattern value="(multipart|message)/.+)" /> > </xs:restriction> > </xs:simpleType> > > It doesn't do a completely outstanding job of verifying content types, but > it's close enough for gummint work, eh? And could prolly be improved > without great effort. > > Which gives you MIME messages in XML envelopes. Just a <snicker /> in the > global namespace .... Major +1 from me - the use of the pattern constraining facet is especially nice. DB
Received on Monday, 10 March 2003 17:10:52 UTC