Copyright © 2004 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.
This document addresses the ability to declare the specific media type that is associated with binary data in an XML document. It is expected that the additional information on the media type will be used for optimizing the handling of binary data that is part of a message.
This is a draft document prepared for review purposes only. This document is published by the joint media-types task force of [WSD WG] and [XMLP WG] in the [WS Activity].
1 Introduction
1.1 Notational
Conventions
1.2 Requirements
2 Attributes for Declaring Media Types
2.1 mediaType
attribute component
2.2 acceptedMediaType
attribute component
3 Declaring media types for binary data
3.1 Role of
xmlmime:acceptedMediaType attribute
4 References
Data sent and received over the Web typically uses the the MIME media type defined by [rfc2046], as the type system. For example, "image/jpeg", "application/pdf". As Web services get widely deployed, there is a need to indicate the media type of the XML content in the messages sent and received by Web services. There is also a need to express the media type information using [XML Schema: Datatypes], which is the type system used by [WSDL 2.0 Part 1] to describe Web services. This would allow Web services to utilize the widely deployed and supported MIME media type infrastructure.
[XOP] and [MTOM] enables one to serialize binary content (an element information item of type xs:base64Binary) in an optimized way using MIME packaging. There is a desire to specify the media type information of such binary data in a standard way in the [XML Information Set] and not just in the optimized serialization of that Infoset.
This document specifies:
a mechanism to indicate the media type of an element information item whose type is xs:base64Binary.
a mechanism to indicate in XML Schema the acceptable media type(s) for an Element whose type is xs:base64Binary.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [rfc2119].
This specification uses properties from the XML Information Set, see [XML Information Set]. Such properties are denoted by square brackets, e.g. [namespace name].
This specification uses namespace prefixes that are listed in Table 1. Note that the choice of any namespace prefix is arbitrary and not semantically significant (see [XML Information Set]).
Prefix | Namespace | Definition |
---|---|---|
xmime | "http://www.w3.org/@@@@/@@/xmlmime" | Defined by this specification |
wsdl | "http://www.w3.org/@@@@/@@/wsdl" | Defined by the WSDL 2.0 specification. A normative XML Schema [XML Schema: Structures], [XML Schema: Datatypes] document for the "http://www.w3.org/@@@@/@@/wsdl" namespace can be found at http://www.w3.org/@@@@/@@/wsdl. |
xs | "http://www.w3.org/2001/XMLSchema" | Defined in the W3C XML Schema specification [XML Schema: Structures], [XML Schema: Datatypes]. |
Namespace names of the general form "http://example.org/..." and "http://example.com/..." represent application or context-dependent URIs [IETF RFC 2396].
This section describes the set of requirements that this document addresses.
This section defines two global attribute components for declaring the media type of binary data in XML Schema to address the requirements (1) and (2) above. Their usage is addressed in Section 3 Declaring media types for binary data.
Attribute declaration for the mediaType
attribute
specifies the following Infoset properties.
Property | Value |
---|---|
{name} | mediaType |
{target namespace} | http://www.w3.org/@@@@/@@/xmlmime; |
{type definition} | xs:string |
{scope} | global |
The content model for the mediaType
is an IANA
media type token.
The value of the mediaType
attribute component MUST be
the
name of a IANA media type token, e.g."image/jpeg".
Attribute declaration for the acceptedMediaType
attribute
specifies the following Infoset properties:
Property | Value |
---|---|
{name} | acceptedMediaType |
{target namespace} | http://www.w3.org/@@@@/@@/xmlmime |
{type} | xs:string |
{scope} | global |
The value that the type
attribute component must
follow the production rules defined by HTTP 1.1 specification, Section
14.1 [IETF RFC 2616].
The value of the mediaType
attribute SHOULD be allowed
by the acceptedMediaType
, if specified in the schema.
Issue (wild-cards-for-mediatype-values):
Should media-type values allow wild cards
Source: HTTP/MIME allow wildcards for declaring accepted media-types. Should this specification also allow wildcards for acceptedMediaTypes and/or mediaType attribute values, such as "image/*"?. There is already an issue recorded for this problem by XMLP as stated in XMLP Issue 443
Resolution:
None recorded.
Production Rules
Source: Depending on the resolution of the previous issue, the production rules in defining acceptable values as they include "Accept:" token as part of the value in [IETF RFC 2616]. The appendix schema therefore uses the current value defined by the [PASWA] document to reflect this in the schema.
Resolution:
None recorded.
Documents that want to utilize additional media type information SHOULD denote this by using a binary element information item. A binary element information item is an element information item defined with the following additional Infoset properties.
mediaType
attribute information
item as described above in
3.1 mediaType
attribute component. The mediaType
attribute information item
allows applications that want
to interpret or optimize the binary data defined by a binary
element information item and should
be considered meta-data. The presence of the xmlmime:mediaType
attribute does not change the value of the element.
Example:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://example.com/thisexample" targetNamespace="http://example.com/thisexample"> <xs:import namespace="http://www.w3.org/@@@@/@@/xmlmime" schemaLocation="http://www.w3.org/@@@@/@@/xmlmime"/> <xs:complexType name="Picture"> <xs:simpleContent> <xs:extension base="xs:base64Binary" > <xs:attribute ref="xmlmime:mediaType" use="optional" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element name="companyPicture" type="tns:Picture"/> </xs:schema>
The acceptedMediaType
attribute is for decorating
the schema by using extensibility to indicate the accepted range of
values for xmlmime:mediaType
attribute only. The
xmlmime:acceptedMediaType
attribute addresses Requirement
(2).
Note:
Alternative ways of indicating this meta-data has been covered and discussed at the WSD September Meeting in detail [WSDL September 2003 Face to Face Meeting]. The writeup captures the conclusions of this discussion by utilizing an attribute to designate the media type.
Applications that need to specify acceptable media types
SHOULD use the attribute when declaring binary elements to declare the
range of acceptable values. The decoration only applies as a hint for
the binary element information items in the Infoset.
Therefore, it is used in conjunction with
the declaration of binary element information items in the
schema. If
xmlmime:acceptedMediaType
attribute is not used, the value
"*/*" SHOULD be assumed.
Example:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://example.com/thisexample" targetNamespace="http://example.com/thisexample"> <xs:import namespace="http://www.w3.org/@@@@/@@/xmlmime" schemaLocation="http://www.w3.org/@@@@/@@/xmlmime"/> <xs:complexType name="Picture"> <xs:simpleContent> <xs:extension base="xs:base64Binary" > <xs:attribute ref="xmlmime:mediaType" use="optional" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element name="companyPicture" type="tns:Picture" xmlmime:acceptMediaType="image/*"/> </xs:schema>
This note is developed by the participants of the joint media types task force formed by WSD and XMLP working groups. Participants are TBD.
Note:
The following definitions are taken from [PASWA].
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/@@@@/@@/xmlmime" targetNamespace="http://www.w3.org/@@@@/@@/xmlmime" > <xs:attribute name="mediaType" > <xs:simpleType> <xs:restriction base="xs:string" > <xs:pattern value="(text|application|image|audio|video|model|multipart|message|x-[-.a-z0-9]+)/[a-z0-9] [-.+a-z0-9]+(;\s?.+=.+)*" /> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="acceptMediaType" > <xs:simpleType> <xs:restriction base="xs:string" > <xs:pattern value="(text|application|image|audio|video|model|multipart|message|x-[-.a-z0-9]+)/ [a-z0-9][-.+a-z0-9]+(;p=(1\.0|0\.\d+))?" /> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:schema>