W3C

Compound Document by Reference Framework 1.0

Editor's Draft 16 April 2007

This version:
http://www.w3.org/TR/2006/WD-CDR-20061122/
Latest version:
http://www.w3.org/TR/CDR/
Previous version:
http://www.w3.org/TR/2006/WD-CDR-20060811/
Editors:
Timur Mehrvarz, Vodafone Group Services Limited
Lasse Pajunen, Nokia
Julien Quint, DAISY Consortium
Daniel Appelquist, Vodafone Group Services Limited

Abstract

This document specifies the Compound Document by Reference Framework 1.0.

When combining separate markup languages, specific problems have to be resolved that are not addressed by their individual language specifications, such as the propagation of events across namespaces, the combination of rendering or the user interaction model.

Compound Document is the W3C term for a document that combines multiple formats.

Status of this Document

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.

This is a W3C Candidate Recommendation of CDRF 1.0. This document is based upon the CDRF 1.0 published on 22 November 2006. The current draft contains editorial improvements, and minor changes in response to Last Call comments. The disposition of Last Call comments is available (first last call comments, second last call comments). Changes are summarized in E Changes Log to review changes since the last Working Draft.

The Compound Document Format Working Group will advance the CDRF 1.0 to Proposed Recommendation when the following exit criteria have been met:

Implementation results will be released publicly. These results are only serving as proof of CDRF implementability. They are only a snap shot of the actual implementation behaviors at one moment of time and should not be construed as describing the conformance status of implementations at any later date.

Table of Contents

1 Introduction to Compound Documents
    1.1 Scope
    1.2 Related Documents
    1.3 Reference and Inclusion
    1.4 Referencing Child Objects
    1.5 Identification and Versioning
2 Compound Document by Reference (CDR)
    2.1 Document Object Model
    2.2 Events

Appendices

A Definitions
B Conformance
C References
    C.1 Normative
    C.2 Informative
D Acknowledgements (Non-Normative)
E Changes Log (Non-Normative)


1 Introduction to Compound Documents

1.2 Related Documents

(This section is informative)

WICD Core

WICD Core [WICDCORE] is the foundation of rich multimedia content and describes rules for combining Hypertext Markup Language (XHTML) and scalable child objects, such as Scalable Vector Graphics (SVG) in a non device specific manner. WICD stands for Web Integrated Compound Document.

WICD Core builds upon CDRF.

1.3 Reference and Inclusion

(This section is informative)

A namespace uniquely identifies a set of names so that there is no ambiguity when objects having different origins but the same names are mixed together. An XML namespace is a collection of element type and attribute names. These element types and attribute names are uniquely identified by the name of the unique XML namespace of which they are a part. In an XML document, any element type or attribute name can thus have a two-part name consisting of the namespace name and the element or attribute name.

A Compound Document by inclusion combines XML markup from several namespaces into a single physical document. A number of standards exist, and continue to be developed, that are descriptions of XML markup within a single namespace. XHTML, XForms, VoiceXML, and MathML are some of the prominent examples of such standards, each having its own namespace. Each of these specifications focuses on one aspect of rich-content development. For example, XForms focuses on data collection and submission, VoiceXML on speech, and MathML on the display of mathematical notations.

To authors of content, each of these many standards is useful and important. However, it is the combination of elements of any number of these standards that lends true flexibility and power to rich document creation. A document may exist to be displayed within a web browser, to display an input form, with a scalable graphic and a bit of mathematical notation, all on the same page. XHTML, XForms, SVG, and MathML, respectively, serve these needs, and could therefore be combined into a single multi-namespace document.

Consider this simple example, a Compound Document combining XHTML and MathML. The namespace declarations are marked by an appended comment to match the numbered namespaces listed below in the XML source in Example 1.

  1. XHTML Namespace declaration. The namespace for XHTML 1.0 is declared. Each XHTML element in the example below is qualified with the xhtml: namespace prefix.

  2. MathML Namespace declaration. The namespace for MathML 2.0 is declared. Each MathML element in the example below is qualified with the mathml: prefix.

A Compound Document example:

Example 1: A Simple Compound Document

A Compound Document

Figure 1 (above): Rendered Simple Compound Document - This is a rendered version of the simple Compound Document in Example 1 which combines XHTML and MathML for rich content.

Compound Documents may be composed of a single document that contains multiple namespaces, as seen in Example 1. This is a Compound Document “by Inclusion” (CDI). However, a Compound Document may also be composed over several documents in which one document of a particular namespace references another separate document of a different namespace.

For example, a root or top-most document might contain XHTML content for defining and formatting a page. This parent XHTML document can reference another document, of another namespace, through the use of the XHTML <object> tag. This can be repeated for as many documents as necessary. The root document plus this collection of separate, referenced documents is considered a Compound Document “by Reference” (CDR). See Figure 2 for a simple CDR document in which an XHTML root document contains a reference to a separate SVG child document having markup for three colored circles.

An XHTML document referencing an SVG document with 3 overlapping colored circles

Figure 2 (above): Compound Document by Reference - A simple Compound Document by reference where a XHTML document references a separate SVG document. Below you see the two markup fragments.

XHTML:

<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>circles</title>
  </head>
  <body>
    <object height="350" width="600" type="image/svg+xml" data="circles.svg"/>
  </body>
</html>

SVG:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" baseProfile="tiny" version="1.2">
  <g fill-opacity="0.7" stroke="black" stroke-width="0.2cm">
    <circle fill="red" cx="6cm" cy="2cm" transform="translate(0,50)" r="100"/>
    <circle fill="blue" cx="6cm" cy="2cm" transform="translate(70,150)" r="100"/>
    <circle fill="green" cx="6cm" cy="2cm" transform="translate(-70,150)" r="100"/>
  </g>
</svg>

And of course, a Compound Document may be a hybrid of both compound document by inclusion and Compound Document by reference.

2 Compound Document by Reference (CDR)

2.1 Document Object Model

Compound document profiles which leverage the Compound Document Framework and which support scripting must have scripting interfaces that are compatible with the uDOM, or implement a superset such as the DOM Level 3 Core Specification [DOM3CORE].

Compound Document profiles may subset DOM Level 3 Core [DOM3CORE], but any DOM Core subsetting should be coordinated with other related DOM subsetting standards efforts. For example, mobile subset efforts for W3C languages such as XHTML, SVG, SMIL and XForms should be coordinated with each other because of the high probability that Compound Document profiles will be defined that combine these languages.

A Compound Document using references consists of a root document which may have one or more child documents, which may in turn have its own child documents. Each child document contains elements and attributes from one or more namespaces. The consequence of this is that each child document generates its own DOM. The interaction points between parent and child documents of a Compound Document are at referencing DOM nodes in a parent document. The Compound Document framework provides a means of accessing the DOMs of the child and parent documents.

Each child document DOM generates its own scripting execution context. Each child DOM scripting execution context provides access to its corresponding global object. The CSS [CSS21] style-sheet cascade is applied to each DOM in isolation. CSS property inheritance is inhibited at document boundaries. It is possible for a content author to use child-to-parent (see 2.1.2 Child to Parent DOM Access) or parent-to-child (see 2.1.3 Parent to Child DOM Access) to propagate specific styling properties.

2.1.2 Child to Parent DOM Access

User agents must allow the child DOM to access the parent DOM.

For a child document to access the parent document, this specification relies on the Window Object's frameElement attribute [WINDOW]. The frameElement attribute can be accessed from the document attribute [DOM2VIEWS] using the defaultView attribute [DOM2VIEWS]. Profiles built upon this specification must specify on which exact document objects these interfaces must be implemented.

Example usage of defaultView.frameElement in child.svg

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
  height="20" version="1.1" width="20">
	<title>child-svg</title>
	<rect fill="blue" height="20"
		onload="alert('Child has seen: ' + 
          document.defaultView.frameElement.ownerDocument.title)"
		width="20" x="10" y="10" />
</svg>

2.1.3 Parent to Child DOM Access

User agents must allow the parent DOM to access any child DOM. The contentDocument attribute must represent the child document.

DOM Level 2 HTML defines a way for several elements to access the child document using the contentDocument attribute [DOM2HTML]. The contentDocument only applies to objects implementing the Element interface defined in DOM Level 3 Core. [DOM3CORE]. Profiles built upon this specification must specify on which exact element objects the interface must be implemented.

Example usage of contentDocument in parent.xhtml:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head> 
    <title>parent-xhtml</title>
  </head> 
  <body> 
    <object data="child.svg" 
      onload="alert('Parent has seen: ' + 
        this.contentDocument.getElementsByTagNameNS(
          'http://www.w3.org/2000/svg',
          'title') [0].textContent)"  />
  </body>
</html>

2.2 Events

Compound Document profiles which leverage the Compound Document Framework and which support events and interactivity must have event interfaces and an event processing model that are compatible with the DOM Level 3 Events Specification [DOM3EVENTS].

Compound Document profiles may subset DOM Level 3 Events [DOM3EVENTS], but any DOM Events subsetting should be coordinated with other related DOM subsetting standards efforts. For example, mobile subset efforts for W3C languages such as XHTML, SVG, SMIL and XForms should be coordinated with each other because of the high probability that Compound Document profiles will be defined that combine these languages.

2.2.1 Event Propagation

Using the various methods and attributes described in the Window API [WINDOW], in DOM Level 3 Events [DOM3EVENTS] and DOM Level 3 Core [DOM3CORE] it is possible for web authors to attach an event listener to a child document; and then upon catching it, dispatch it to the parent document on the referencing element. The following piece of script would create an event and dispatch it upon the referencing element:

var x = document.createEvent("CustomEvent");
x.initCustomEventNS("http://example.org/test", "test", true, false, null);
window.frameElement.dispatchEvent(x);

2.2.2 Event-Related Markup

In order to claim conformance to this Compound Documents Framework, a Compound Document profile must define how all of its event-related language constructs and scripting constructs map to corresponding DOM Level 3 Event facilities [DOM3EVENTS], unless DOM Level 3 Events has already defined the mapping. In particular:

For each event construct within supported languages, the profile must define the event's namespace and local name, whether it supports the bubble phase, and whether it is cancellable, as well as the name of the DOM interface for its event structure (e.g., events.dom.w3c.org::UIEvent).

Any events that are defined to be equivalent to a corresponding event from DOM Level 3 Events [DOM3EVENTS] must have compatible behavior, such as the phases supported, cancellability and propagation across parent/child Compound Document boundaries. For example, for a "click" event from language A to be equivalent to the DOM3 "click" event, it also must be cancellable since DOM3 "click" is cancellable.

The profile must define how to map language features for event listeners, event handlers, and event targets into corresponding DOM Level 3 Events facilities [DOM3EVENTS].

A Definitions

The following terms and definitions are used within this document.

Child Document

In the case of combining by reference, one compound document may be a collection of several separate documents.

The document that is referenced is called a child document. If a child document itself references other documents, then it is also a parent document.

Compound Document

A Compound Document is a document that combines mutliple document formats either by reference, by inclusion or both.

Compound Document by Inclusion (CDI)

A document which directly includes other documents and or namespace markup within the same physical document.

For example: A single XML document making use of XML grammars defined independently, normally making use of multiple namespaces.

Compound Document by Reference (CDR)

A document which logically includes other documents via a hypertext reference.

Focus traversal

Focus traversal defines the elements that get focus and the order, in which they are traversed.

Parent Document

In the case of combining by reference, one compound document may be a collection of several separate documents.

A parent document represents a document that has a DOM as defined by DOM Level 3 Core and references another document. The DOM that is formed must be tree-based.

Root Document

In the case of combining by reference, one compound document may be a collection of several separate documents.

The outermost parent document is called the root document.

Scalable Child Document

A Scalable Child Document is a Child Document for which rendering is possible at a range of output sizes. Scalable means not being limited to a single, fixed, pixel size.

Subset profile

A reduced set of capabilities from the original specification. Meaning, that the subset doesn't add any new features, but only removes them. Content that conforms to the profiled subset must be rendered successfully by a compliant user agent of the full/superset specification. In other words, the full user agent doesn't need to know it is content from a subset profile.

User Agent

See definition in Device Independence Glossary document.

B Conformance

This specification defines conformance for several classes of products:

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 (see ). However, for readability, these words do not appear in all uppercase letters in this specification.

At times, this specification recommends good practice for authors and user agents. These recommendations are not normative and conformance with this specification does not depend on their realization. These recommendations contain the expression "We recommend ...", "This specification recommends ...", or some similar wording.

User Agent Conformance

  1. User agents must allow the child DOM to access the parent DOM.

  2. User agents must allow the parent DOM to access any child DOM. The contentDocument attribute must represent the child document.

  3. A conformant user agent of a superset profile specification must process subset profile content as if it were the superset profile content.

Profile Conformance

  1. Compound Document profiles which support scripting must have scripting interfaces that are compatible with the DOM Level 3 Core Specification.

  2. Compound Document profiles which support events and interactivity must have event interfaces and an event processing model that are compatible with the DOM Level 3 Events Specification.

  3. For each event construct within supported languages, the profile must define the event's namespace and local name, whether it supports the bubble phase, and whether it is cancellable, as well as the name of the DOM interface for its event structure (e.g., events.dom.w3c.org::UIEvent).

  4. Any events that are defined to be equivalent to a corresponding event from DOM3 Events must have compatible behavior, such as the phases supported, cancellability and propagation across parent/child Compound Document boundaries. For example, for a "click" event from language A to be equivalent to the DOM3 "click" event, it also must be cancellable since DOM3 "click" is cancellable.

  5. The profile must define how to map language features for event listeners, event handlers, and event targets into corresponding DOM3 Events facilities.

  6. A conformant subset profile must not add new features from their corresponding superset specification.

  7. A conformant profile must define any dependent subset profiles.

C References

C.1 Normative

[CSS21]
Cascading Style Sheets, level 2 revision 1 CSS 2.1 Specification , Håkon Wium Lie, Tantek Çelik, Bert Bos, and Ian Hickson, Editors. World Wide Web Consortium, 06 Nov 2006. This version is http://www.w3.org/TR/2006/WD-CSS21-20061106. The latest version is available at http://www.w3.org/TR/CSS21.
[DOM2HTML]
Document Object Model (DOM) Level 2 HTML Specification , Johnny Stenback, Philippe Le Hégaret, and Arnaud Le Hors, Editors. World Wide Web Consortium, 09 Jan 2003. This version is http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030107. The latest version is available at http://www.w3.org/TR/DOM-Level-2-HTML/.
[DOM2VIEWS]
Document Object Model (DOM) Level 2 Views Specification , Laurence Cable and Arnaud Le Hors, Editors. World Wide Web Consortium, 13 Nov 2000. This version is http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113. The latest version is available at http://www.w3.org/TR/DOM-Level-2-Views.
[DOM3CORE]
Document Object Model (DOM) Level 3 Core Specification , Jonathan Robie, Steve Byrne, Philippe Le Hégaret, et al. , Editors. World Wide Web Consortium, 07 Apr 2004. This version is http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407. The latest version is available at http://www.w3.org/TR/DOM-Level-3-Core/.
[DOM3EVENTS]
Document Object Model (DOM) Level 3 Events Specification , Tom Pixley and Philippe Le Hégaret, Editors. World Wide Web Consortium, 13 Apr 2006. This version is http://www.w3.org/TR/2006/WD-DOM-Level-3-Events-20060413. The latest version is available at http://www.w3.org/TR/DOM-Level-3-Events/.
[WINDOW]
Window Object 1.0 , Ian Davis and Maciej Stachowiak, Editors. World Wide Web Consortium, 07 April 2006. This version is http://www.w3.org/TR/2006/WD-Window-20060407/. The latest version is available at http://www.w3.org/TR/Window.

C.2 Informative

[WICDCORE]
WICD Core 1.0 , Timur Mehrvarz, Daniel Appelquist, Lasse Pajunen, and Julien Quint, Editors. World Wide Web Consortium, 22 Nov 2006. This version is http://www.w3.org/TR/2006/WD-WICD-20061122/. The latest version is available at http://www.w3.org/TR/WICD/.
[MATHML2]
Mathematical Markup Language (MathML) Version 2.0 (Second Edition) , David Carlisle, Patrick Ion, Robert Miner, and Nico Poppelier, Editors. World Wide Web Consortium, 21 Oct 2003. This version is http://www.w3.org/TR/2003/REC-MathML2-20031021/. The latest version is available at http://www.w3.org/TR/MathML2/.
[XML]
Extensible Markup Language (XML) 1.0 (Fourth Edition) , C. M. Sperberg-McQueen, Eve Maler, Tim Bray, et al. , Editors. World Wide Web Consortium, 16 August 2006. This version is http://www.w3.org/TR/2006/REC-xml-20060816. The latest version is available at http://www.w3.org/TR/xml.
[XML-NAMES]
Namespaces in XML 1.0 (Second Edition) , Tim Bray, Dave Hollander, Andrew Layman, and Richard Tobin, Editors. World Wide Web Consortium, 16 Aug 2006. This version is http://www.w3.org/TR/2006/REC-xml-names-20060816. The latest version is available at http://www.w3.org/TR/xml-names.
[VOICEXML2]
Voice Extensible Markup Language (VoiceXML) Version 2.0 , Jim Ferrans, Bruce Lucas, Ken Rehor, et al. , Editors. World Wide Web Consortium, 16 Mar 2004. This version is http://www.w3.org/TR/2004/REC-voicexml20-20040316/. The latest version is available at http://www.w3.org/TR/voicexml20.
[SMIL2]
Synchronized Multimedia Integration Language (SMIL 2.1) , Dick Bulterman et al., Editors. World Wide Web Consortium, 13 Dec 2005. This version is http://www.w3.org/TR/2005/REC-SMIL2-20051213/. The latest version is available at http://www.w3.org/TR/SMIL2/.
[SVGMOBILE12]
Scalable Vector Graphics (SVG) Tiny 1.2 Specification Ola Andersson, Robin Berjon, Erik Dahlström, Andrew Emmons, Jon Ferraiolo, Vincent Hardy, Scott Hayman, Dean Jackson, Chris Lilley, Andreas Neumann, Craig Northway, Antoine Quint, Nandini Ramani, Doug Schepers, and Andrew Shellshear, Editors. World Wide Web Consortium, 10 Aug 2006. This version is http://www.w3.org/TR/2006/CR-SVGMobile12-20060810/. The latest version is available at http://www.w3.org/TR/SVGMobile12/.
[XFORMS]
XForms 1.0 (Second Edition) , D. Landwehr, J. Boyer, T. V. Raman, M. Dubinko, R. Merrick, L. L. Klotz, Editors, W3C Recommendation, 14 March 2006, http://www.w3.org/TR/2006/REC-xforms-20060314/ . The latest version is available at http://www.w3.org/TR/xforms/ .
[XHTML11]
XHTML™ 1.1 - Module-based XHTML , Murray Altheim and Shane McCarron, Editors. World Wide Web Consortium, 31 May 2001. This version is http://www.w3.org/TR/2001/REC-xhtml11-20010531. The latest version is available at http://www.w3.org/TR/xhtml11/.
[HTML4]
HTML 4.01 Specification , David Raggett, Arnaud Le Hors, and Ian Jacobs, Editors. World Wide Web Consortium, 24 Dec 1999. This version is http://www.w3.org/TR/1999/REC-html401-19991224. The latest version is available at http://www.w3.org/TR/html401.

D Acknowledgements (Non-Normative)

The editors would like to thank the contributors:

E Changes Log (Non-Normative)

2007-04-16
2007-03-31
2007-03-26
2007-03-14
  • Changed "inclusion boundaries" to "document boundaries" in 2.1 Document Object Model. (JQ)

  • Added the sentence "It is possible for a content author to use child-to-parent (see 2.1.2 Child to Parent DOM Access) or parent-to-child (see 2.1.3 Parent to Child DOM Access) to propagate specific styling properties." right after (JQ)

2007-02-11
2007-03-13
2007-02-11
2007-02-02
  • Removed outdated Document Conformance heading and security statement from B Conformance. (SS)