XML-binary Optimized Packaging

XML-binary Optimized Packaging (XOP) is a mechanism defined for the serialization of XML Information Sets (infosets) that contain binary data, as well as deserialization back into the XML Information Set.

## Benefits[edit]

XOP allows the binary data part of an XML Infoset to be serialized without going through the XML serializer. The XML serialization of an XML Infoset is text based, so any binary data will need to be encoded using base64. Using XOP avoids this by extracting the binary data out of the XML Infoset so that the XML Infoset does not contain binary data and the binary data can be serialized differently.

Therefore, XOP can reduce the size of the serialization (since base64 encoding has approximately a 33% size overhead) and (depending on how it is implemented) might allow processing efficiencies. This size increase results in extra resources needed to transmit or store the data.

## Costs[edit]

XOP introduces another level of processing. Therefore, it introduces extra complexity and processing overheads.

The representation of the XOP packages introduces some overhead. These are negligible when the binary data is large, but could be significant if the binary data is small.

## Operation[edit]

XOP operates on a single XML Infoset.

The binary parts of the original XML infoset are extracted out, leaving an "XOP Infoset" (which is essentially the original XML Infoset with the binary parts replaced by external references). The references in the XOP Infoset are represented using the "xop:Include" element. The XOP Infoset plus the extracted content can be serialized into a representation called the "XOP Package". The XOP Package can be sent or stored.

To reconstitute the XML Infoset, the XOP Package is deserialized into the XOP Infoset plus the extracted content, and then the extracted content is put back into the XML Infoset.

## XOP Packages[edit]

XOP can be used with a number of different packaging mechanisms. A packaging mechanism defines how the XOP Infoset and the binary chunks are represented.

The XOP specification defines how MIME can be used as a packaging mechanism. When used with MIME, the XOP Infoset is represented as XML in the root MIME part, and the binary chunks are represented in the other MIME parts. Those other MIME parts can be serialized as binary data, avoiding the need to base64 encode them if they were left inside the XML Infoset.

XOP does not mandate the use of the MIME packaging mechanism, so other packaging mechanisms could be used.

## Usage in SOAP Web services[edit]

The MIME packaging mechanism is the most widely used, since XOP is usually used to represent SOAP messages with MTOM.

For example:

MIME-Version: 1.0
Content-Type: Multipart/Related;boundary=MIME_boundary;
...
--MIME_boundary
Content-Type: application/xop+xml;

...

<soap:Envelope> ...
<soap:Body> ...
<m:photo xmlmime:contentType="image/png">
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include"
href="cid:http://example.org/me.png"/></m:photo>

...

--MIME_boundary
Content-Type: image/png
Content-Transfer-Encoding: binary
Content-ID: <http://example.org/me.png>

// binary octets for png

## See also[edit]

* MTOM (Message Transmission Optimization Mechanism)

## References[edit]

* XML-Binary Optimized Packaging (article from Dr Dobbs)

## External links[edit]

* W3C's XML-binary Optimized Packaging W3C Recommendation

* v
* t
* e

World Wide Web Consortium (W3C)

Products and
standards|

| Recommendations|

* ActivityPub
* Activity Streams
* ARIA
* Canonical XML
* CDF
* CSS
* Animations
* Flexbox
* Grid
* DOM
* Geolocation API
* HTML
* HTML5
* IndexedDB
* ITS
* JSON-LD
* Linked Data Notifications
* MathML
* Micropub
* OWL
* PLS
* RDF
* Schema
* SISR
* SKOS
* SMIL
* SOAP
* SRGS
* SRI
* SSML
* SVG
* Filter Effects
* SCXML
* SHACL
* SPARQL
* Timed text
* VoiceXML
* WoT
* TD
* Web storage
* WSDL
* Webmention
* WebSub
* XHTML
* +RDFa
* XML
* Base
* Encryption
* Events
* Information Set
* Namespace
* Schema
* Signature
* XForms
* XInclude
* XLink
* XOP
* XPath
* 2.0
* 3.x
* XPointer
* XProc
* XQuery
* XSL
* XSL-FO
* XSLT
* elements

|

Notes|

* IndieAuth
* XAdES
* XBL
* XHTML+SMIL
* XUP

Working drafts|

* CCXML
* CURIE
* EME
* InkML
* MSE
* RIF
* SMIL Timesheets
* sXBL
* WebGPU
* WebXR
* XFDL
* XFrames
* XMLHttpRequest

Guidelines|

* Web Content Accessibility Guidelines

Initiative|

* Markup Validation Service
* Web Accessibility Initiative
* Web Components

Deprecated|

* C-HTML
* HDML
* JSSS
* PGML
* VML
* WebPlatform

Obsoleted|

* P3P
* XHTML+MathML+SVG

Organizations|

* World Wide Web Foundation

Working groups|

* TAG
* CSS
* SVG
* WebAssembly
* WebAuthn
* WHATWG

Community & business groups|

* Web Advertising BG
* WebAssembly CG

Closed groups|

* Device Description (DDWG)
* HTML
* Multimodal Interaction Activity (MMI)

Software|

* CERN httpd
* Libwww

Browsers|

* Line Mode (1990–)
* Arena (1993–98)
* Agora (1994–97)
* Argo (1994–97)
* Amaya (browser/editor, 1996–2012)

Conferences|

* International World Wide Web Conference (IW3C)
* Steering Committee (IW3C2)
* First conference ("WWW1", 1994)

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template