Copyright © 2004 W3C ® ( MIT , ERCIM , Keio ), All Rights Reserved. W3C liability , trademark </a>, and document use deleted text: and <a href= "http://www.w3.org/Consortium/Legal/copyright-software"> software licensing </a> rules apply.
This document addresses the need to indicate the media type associated with binary element content in an XML document and the need to specify, in XML Schema, the expected media types type(s) associated with binary element content. It is expected that the additional information about the media type will be used for optimizing the handling of binary data that is part of a Web services message.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This is the <a href= "http://www.w3.org/2004/02/Process-20040205/tr.html#RecsWD"> First Public a W3C Last Call Working Draft </a> . A diff-marked version against the previous version of this document is available. If the Assigning Media Types feedback is positive, the Working Groups plans to Binary Data in XML document. publish the final version of this specification as a W3C Working Group Note. Comments on this document are invited and are to be sent to the public public-ws-media-types@w3.org mailing list ( public archive ). Comments can be sent until 24 November 2004 .
It has been produced jointly by the XML Protocol Working Group , and the Web Services Description Working Group , which are part of the Web Services Activity .
The current intention of the Publication as a Working Groups Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to issue the final version of cite this specification document as a Working Group Note. other than work in progress.
This document has been produced under the 24 January 2002 Current Patent Practice as amended by the W3C Patent Policy Transition Procedure . Patent disclosures relevant to this specification may be found on the Web Services Description Working Group's Group patent disclosure page and on the XML Protocol Working Group's Group patent disclosure page . An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification should disclose the information in accordance with section 6 of the W3C Patent Policy .
deleted text: <p> Discussion of this document takes place on the public <a href= "mailto:public-ws-media-types@w3.org"> public-ws-media-types@w3.org </a> mailing list ( <a href= "http://lists.w3.org/Archives/Public/public-ws-media-types/"> public archive </a> ) of the joint media-types task force of the <a href= "http://www.w3.org/2000/xp/Group/"> XML Protocol Working Group </a>, and the <a href="http://www.w3.org/2002/ws/desc/"> Web Services Description Working Group </a>. A <a href= "http://dev.w3.org/cvsweb/%7Echeckout%7E/2002/ws/desc/issues/wsd-issues.html"> list of open issues against this document </a> is available. </p> <p> Comments on this document are invited and are to be sent to the public <a href= "mailto:public-ws-media-types@w3.org"> public-ws-media-types@w3.org </a> mailing list ( <a href= "http://lists.w3.org/Archives/Public/public-ws-media-types/"> public archive </a> ). </p> <p> Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p>
1
Introduction
1.1
Notational
Conventions
1.2
Requirements
2
Attributes
for
Declaring
Media
Types
2.1
contentType
attribute
2.2
expectedMediaType
element
attribute
3
Declaring
media
types
for
binary
data
3.1
Role
of
expectedMediaType
Schema
annotation
element
attribute
4
Examples
4.1
Binary
data
with
known
media
type
4.2
Binary
data
with
preferred
media
type
5
References
A
Acknowledgements
B
Appendix
deleted text:
Attribute
Schema
Data sent and received over the Web typically uses the deleted text: the MIME media type defined by [IETF RFC 2046] , as the type system. For example, "image/jpeg", "application/pdf". As Web services get widely deployed, there There is a need to indicate the media type of the XML element content content, for example, in deleted text: 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] </a> to describe Web services. . This would allow XML-based applications, such as Web services services, to utilize the widely deployed and supported MIME media type infrastructure.
[XOP] and [MTOM] enables one to serialize binary content (element content that is in a canonical lexical representation of the xs:base64Binary type) in an optimized way using MIME packaging. There is a desire to specify the media type information of such binary element content in a standard way in the [XML Information Set] and not just in the optimized serialization of that Infoset.
This document specifies:
a mechanism An attribute ( xmlmime:contentType ) to indicate the media type of an XML element content whose type is xs:base64Binary or xs:hexBinary . The value of the attribute is the name of a IANA media type token (e.g., "text/xml; charset=utf-16"). This attribute specifies the media type of the content of an element on which it occurs.
a mechanism A XML Schema annotation attribute ( xmlmime:expectedMediaType ) to indicate indicate, in XML Schema Schema, the expected media type(s) for an element content whose type is xs:base64Binary or xs:hexBinary .
The XML Schema annotation, xmlmime:expectedMediaType , specifies the expected range of values for the xmlmime:contentType attribute and the expected range of media types for the binary element content.
Note that the use of this mechanism, in particular the contentType attribute, does not require the implementation, in whole or in part, of XML Schema.
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 [IETF RFC 2119] .
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 |
---|---|---|
xmlmime | http://www.w3.org/2004/06/xmlmime http://www.w3.org/2004/11/xmlmime | Defined by this specification |
wsdl | http://www.w3.org/2004/03/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/2004/03/wsdl namespace can be found at http://www.w3.org/2004/03/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.
<ul>Define how to indicate the media type of an XML element content whose type is xs:base64Binary or xs:hexBinary . This is meta-data that may be, but not required to, used by tools to infer the specific media type of binary data.
Define how to indicate the expected media type(s) of XML element content whose type is xs:baseB4Binary xs:base64Binary or xs:hexBinary in XML Schema. This information is needed to define the set of media types that a binary data may have. For example, a Web services application may be willing to indicate that the binary data represents an image, but leaves it to a document to further specify whether it is "jpeg", "gif", etc. This meta-data is deleted text: used to indicate the set of media types the binary data may have and is not required to be present.
Define the acceptable format of media type values.
Define the relationship between the expected and the actual value of the media types declared for binary data in XML documents.
This section defines a two global attribute information item and an <em> element information item </em> s 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 .
The
contentType
attribute
information
item
has
the
following
Infoset
properties:
A
[local
name]
of
contentType
.
A [namespace name] of "http://www.w3.org/2004/06/xmlmime". "http://www.w3.org/2004/11/xmlmime".
The
type
of
the
contentType
attribute
information
item
is
xs:string
.
The
expectedMediaType
element
attribute
information
item
has
the
following
Infoset
properties:
A
[local
name]
of
expectedMediaType
.
A
[namespace
name]
of
http://www.w3.org/2004/06/xmlmime
http://www.w3.org/2004/11/xmlmime
.
The
type
of
the
expectedMediaType
element
attribute
information
item
is
xs:string
.
The
value
and
the
meaning
of
the
expectedMediaType
element
attribute
is
similar
to
the
value
allowed
for
the
'Accept'
header
defined
by
HTTP
1.1
specification,
Section
14.1
[IETF
RFC
2616]
and
MUST
follow
the
production
rules
defined
in
that
section.
The
'q'
parameter
defined
by
HTTP
1.1
specification,
Section
3.9
[IETF
RFC
2616]
</a>.
is
allowed,
but
other
accept-extensions
are
not
allowed.
Editorial note: | |
The value 'accept-extensions' of the <code> contentType </code> attribute SHOULD be HTTP 'Accept' header are not allowed deleted text: by the <code> expectedMediaType </code>, if specified in the schema, as specified by <a href="#usage"> <b> 3 Declaring media types for binary data </b> </a>. </p> 'expectedMediaType' attribute value. The WSD WG would like to solicit feedback on this. |
The
expectedMediaType
element
attribute
is
intended
to
be
used
as
part
of
a
XML
Schema
annotation
for
a
binary
element
information
item
declaration
(see
3
Declaring
media
types
for
binary
data
).
Documents that want to specify additional media type information for binary data 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. constraints.
An
OPTIONAL
contentType
attribute
information
item
as
described
above
in
2.1
contentType
attribute
.
A type The character information items comprising the [children] of the deleted text: binary element information item must be a type derived from or equal MUST conform to the lexical constraints of xs:base64Binary or xs:hexBinary .
The
[normalized
value]
of
the
contentType
attribute
information
item
MUST
be
the
name
of
a
IANA
media
type
token,
e.g.,
"image/png",
"text/xml;
charset=utf-16"
and
indicates
the
media
type
of
the
[owner
element].
The
contentType
attribute
information
item
allows
Web
services
applications
to
optimize
the
handling
of
the
binary
data
defined
by
a
binary
element
information
item
and
should
be
considered
as
meta-data.
The
presence
of
the
contentType
attribute
does
not
changes
the
value
of
the
element
content.
Example:
For
authoring
convenience,
two
types
xmlmime:base64Binary
and
xmlmime:hexBinary
are
defined
in
B
Appendix
Schema
<?xml version="1.0" ?> <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/2004/06/xmlmime" schemaLocation="http://www.w3.org/2004/06/xmlmime"/> xmlns:tns="http://example.com/ct-required" xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" targetNamespace="http://example.com/ct-required"> <xs:complexType name="Picture"> <xs:simpleContent> <xs:extension base="xs:base64Binary" > <xs:attribute ref="xmlmime:contentType" use="optional" /> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:import namespace="http://www.w3.org/2004/11/xmlmime" schemaLocation="http://www.w3.org/2004/11/xmlmime"/> </xs:element name="companyPicture" type="tns:Picture"/> <!-- This element has binary content and requires the contentType attribute that indicates the media type of the binary content --> <xs:element name="MyBinaryData"/> <xs:complexType> <xs:simpleContent> <xs:restriction base="xs:base64Binary" > <xs:attribute ref="xmlmime:contentType" use="required"/> </xs:restriction> </xs:simpleContent> </xs:complexType> </xs:element> </xs:schema>
The
expectedMediaType
element
attribute
is
used
for
annotating
the
schema
XML
Schema
to
indicate
the
expected
range
of
media
types
of
the
binary
element
content
and
the
expected
range
of
values
for
contentType
attribute
only.
attribute.
The
value
of
the
contentType
attribute,
if
present,
SHOULD
be
within
the
range
specified
by
the
expectedMediaType
element
addresses
Requirement
(2).
annotation
attribute,
if
specified
in
the
schema.
When
the
expectedMediaType
annotation
attribute
has
a
wildcard
("*")
or
a
list
of
acceptable
media
types,
the
schema
SHOULD
require
the
contentType
attribute
to
be
present.
Applications
that
need
to
specify
expected
media
types
SHOULD
use
the
schema
annotation
deleted text:
element
to
declare
the
range
of
expected
values.
deleted text:
The
annotation
should
be
considered
only
as
a
hint.
expectedMediaType
is
annotation
attribute
MAY
be
used
in
conjunction
with
the
declaration
of
binary
element
information
item
s
or
with
complex
type
definitions
that
are
derived
from
xs:base64Binary
or
xs:hexBinary
in
the
schema.
XML
Schema.
If
the
expectedMediaType
annotation
attribute
is
not
used,
used
in
both
the
value
"*/*"
SHOULD
binary
element
information
item
declaration
as
well
as
definition
of
the
complex
type
which
the
binary
element
information
item
belongs
to,
then
the
expected
range
of
values
defined
for
the
binary
element
information
item
MUST
be
assumed.
a
subset
of
the
expected
range
of
values
defined
for
the
complex
type.
Example:
The
example
below
consists
of
a
type
definition,
PictureType
,
and
an
element
declaration,
Picture
.
The
xmlmime:contentType
attribute
is
required
to
be
present
and
specifies
the
media
type
of
the
binary
content.
The
schema
annotation
attribute
xmlmime:expectedMediaType
specifies
that
the
media
type
of
the
binary
content
is
'image',
but
the
subtype
name
is
unknown.
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://example.com/wildcard"
xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime"
targetNamespace="http://example.com/wildcard">
<xs:import namespace="http://www.w3.org/2004/11/xmlmime"
schemaLocation="http://www.w3.org/2004/11/xmlmime"/>
<xs:complexType name="PictureType">
<xs:simpleContent>
<xs:restriction base="xmlmime:base64Binary" >
<xs:attribute ref="xmlmime:contentType" use="required" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<!-- This element designates the range of values
that the element definition will accept -->
<xs:element name="Picture" type="tns:PictureType"
xmlmime:expectedMediaType="image/*"/>
</xs:element>
</xs:schema>
The
example
document
instance
below
conforms
to
the
element
declaration
of
Picture
and
specifies
that
the
binary
content
is
of
type
"image/png".
The example below consists of a binary element whose media type is known in advance to be "image/jpeg".
In this example, the application fixes the media type by declaring it with an annotation in conjunction with the complex type definition.
<?xml version="1.0" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://example.com/thisexample" xmlns:xmlmime="http://www.w3.org/2004/06/xmlmime" targetNamespace="http://example.com/thisexample"> xmlns:tns="http://example.com/know-type" xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" targetNamespace="http://example.com/know-type"> <xs:import namespace="http://www.w3.org/2004/06/xmlmime" schemaLocation="http://www.w3.org/2004/06/xmlmime"/> <xs:import namespace="http://www.w3.org/2004/11/xmlmime" schemaLocation="http://www.w3.org/2004/11/xmlmime"/> <xs:complexType name="Picture"> <xs:simpleContent> <xs:extension base="xs:base64Binary" > <xs:attribute ref="xmlmime:contentType" use="optional" /> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="JPEGPictureType" type="xs:base64Binary" xmlmime:expectedMediaType="image/jpeg"/> <xs:element name="companyPicture" type="tns:Picture" <xs:annotation> <xs:documentation>This element designates the range of values that the declared binary type will accept </xs:documentation> <xs:appInfo> <xmlmime:expectedMediaType>image/*</xmlmime:expectedMediaType> </xs:appInfo> </xs:annotation> </xs:element> <xs:element name="JPEGPicture" type="tns:JpegPictureType"/> </xs:schema>
This example illustrates that binary data with media type 'image/jpeg' is preferred but binary data with media type of 'image/tiff' is also allowed (with a lower preference).
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://example.com/preferred-type"
xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime"
targetNamespace="http://example.com/preferred-type">
<xs:import namespace="http://www.w3.org/2004/11/xmlmime"
schemaLocation="http://www.w3.org/2004/11/xmlmime"/>
<xs:complexType name="JPEGPreferredPictureType">
<xs:simpleContent>
<xs:restriction base="xmlmime:base64Binary" >
<xs:attribute ref="xmlmime:contentType" use="required" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:element name="JPEGPeferredPicture" type="tns:JPEGPreferredPictureType"
xmlmime:expectedMediaType="image/jpeg;q=1.0, image/tiff;q=0.8"/>
</xs:schema>
Editorial note: deleted text: ASK | |
This document addresses the requirements in Issue 443 of the XML Protocol WG issues list. If this document is changed in the future in such a way that the requirements in issue 443 are not addressed, then issue 443 may be reopened by the XML Protocol WG. |
This document is developed by the participants of the joint media types task force formed by Web Services Description and XML Protocol Working Groups. Participants of the taskforce, specifically Martin Gudgin, and Mark Nottingham are gratefully acknowledged.
<?xml version="1.0" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2004/06/xmlmime" targetNamespace="http://www.w3.org/2004/06/xmlmime" > xmlns:xmlmime="http://www.w3.org/2004/11/xmlmime" targetNamespace="http://www.w3.org/2004/11/xmlmime" > deleted text: <xs:attribute name="contentType" > <xs:simpleType> <xs:restriction base="xs:string" > <xs:pattern value="(text|application|image|audio|video|model|x-[-.a-z0-9]+)/ [a-z0-9][-.+a-z0-9]+(;\s?.+=.+)*" /> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:element name="expectedMediaType" > <xs:simpleType> <xs:list itemType="tns:expectedMediaTypeItem" /> </xs:simpleType> </xs:element> <xs:attribute name="contentType" type="xs:string" /> <xs:simpleType name="expectedMediaTypeItem" > <xs:restriction base="xs:string" > <xs:pattern value="(text|application|image|audio|video|model|x-[-.a-z0-9]+)/ (([a-z0-9][-.+a-z0-9]+)|\*)" /> </xs:restriction> </xs:simpleType> <xs:attribute name="expectedMediaType" type="xs:string" /> <xs:complexType name="base64Binary" > <xs:simpleContent> <xs:extension base="xs:base64Binary" > <xs:attribute ref="xmlmime:contentType" /> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="hexBinary" > <xs:simpleContent> <xs:extension base="xs:hexBinary" > <xs:attribute ref="xmlmime:contentType" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:schema>