<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="lib/rfc2629.xslt"?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no" ?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>

<rfc ipr="trust200902"
     category="exp"
     docName="draft-thierry-bulk-xml-00"
     xmlns:x="http://purl.org/net/xml2rfc/ext">
  <x:feedback template="mailto:pierre@nothos.net"/>
  <front>
    <title abbrev="BULK-XML">BULK Simple XML namespace</title>

    <author initials="P." surname="Thierry" fullname="Pierre Thierry">
      <organization>Thierry Technologies</organization>
      <address>
        <email>pierre@nothos.net</email>
      </address>
    </author>

    <date day="7" month="August" year="2013" />
    <keyword>binary</keyword>
    <keyword>xml</keyword>

    <abstract>
      <t>
        This specification describes a BULK serialization of XML data.
      </t>
    </abstract>

  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <section title="Conventions and Terminology">
        <t>
          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 <xref target="RFC2119">RFC 2119</xref>.
        </t>
        <t>
          Literal numerical values are provided in decimal or hexadecimal as appropriate.
          Hexadecimal literals are prefixed with <spanx style="verb">0x</spanx> to distinguish them
          from decimal literals.
        </t>
	<t>
	  BULK bytes sequences and expressions are described with the same conventions than used in
	  the <xref target="BULK1">BULK 1.0 specification</xref>
	</t>
      </section>
    </section>

    <section title="BULK XML namespace">
      <t>
	The Simple XML namespace is an official namespace identified by the UUID <eref
	target="urn:uuid:8e9fbe9c-2b0c-5307-bb81-edb1a7727563"/> (BULK,
	http://www.w3.org/XML/Core/).
      </t>
      <t>
	It is a simplistic notation for the XML data available after parsing an XML document is
	complete. As such, it doesn't provide a way to serialize some components of an XML document,
	such as the contents of the DTD or unparsed entities. In particular, the encoding
	declaration of the XML prolog is not serialized, as BULK sreams already carry encoding
	information. As for any other BULK data, everywhere within an Simple XML form, a <spanx
	style="verb">stringenc</spanx> form can appear.
      </t>
      <t>
	An application writing Simple XML data SHOULD use <spanx style="verb">rdf:prefix</spanx> to
	denote element and attribute prefixed names and arrays for unprefixed names. The semantics
	of the <spanx style="verb">rdf:prefix</spanx> form are application-dependent; an application
	could choose to evaluate it without changing its value beforehand, thus using expanded names
	(cf. <xref target="XML-NAMES10"/> and <xref target="XML-NAMES11"/>), or follow the <xref
	target="XML-INFOSET">XML Infoset</xref> principle of keeping the namespace and local part of
	the name separate.
      </t>
      <t>
	Note that Simple XML cannot store the original prefix associated with a namespace. The goal
	is to be able to serialize just enough data from a parsed XML document that an equivalent
	XML document can be unserialized. By equivalent, we mean that it would have the same
	semantics as the original XML document for applications using this XML format (but defining
	this latter equivalence in a remotely decent way is outside the scope of this
	specification).
      </t>
      <t>
	Character data (corresponding to <spanx style="verb">CDATA</spanx> sections and <spanx
	style="verb">#PCDATA</spanx> in XML) SHOULD be serialized as arrays.
      </t>
      <t>
	Note: authors of BULK XML namespaces are encouraged to define names in such a way that
	frequently-used expressions can be serialized as compactly as possible, using <spanx
	style="verb">rdf:prefix</spanx>, <spanx style="verb">define</spanx>, <spanx
	style="verb">subst</spanx> or any similar constructs. This is particularly straightforward
	and useful for enumerated attributes (but could be used for more complex structures).
      </t>

      <section title="XML 1.0 entity">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x1</spanx> (mnemonic: <spanx
	    style="verb">xml1.0</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( xml1.0 {content} )</spanx></t>
	  </list>
	</t>
	<t>
	  This form denotes an entity (document entity or external entity) whose XML version is
	  1.0.
	</t>
	<t>Type: <spanx style="verb">Entity</spanx></t>
      </section>

      <section title="XML 1.1 entity">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x2</spanx> (mnemonic: <spanx
	    style="verb">xml1.1</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( xml1.1 {content} )</spanx></t>
	  </list>
	</t>
	<t>
	  This form denotes an entity (document entity or external entity) whose XML version is
	  1.1.
	</t>
	<t>Type: <spanx style="verb">Entity</spanx></t>
      </section>

      <section title="Processing instruction">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x3</spanx> (mnemonic: <spanx
	    style="verb">pi</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( pi {target} {content} )</spanx></t>
	  </list>
	</t>
	<t>Type: <spanx style="verb">PI</spanx></t>
      </section>

      <section title="Comment">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x4</spanx> (mnemonic: <spanx
	    style="verb">comment</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( comment {content} )</spanx></t>
	  </list>
	</t>
	<t>Type: <spanx style="verb">Comment</spanx></t>
      </section>

      <section title="Element">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x5</spanx> (mnemonic: <spanx
	    style="verb">element</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( element {name} {content} )</spanx></t>
	  </list>
	</t>
	<t>Type: <spanx style="verb">Element</spanx></t>
      </section>

      <section title="Attribute">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x6</spanx> (mnemonic: <spanx
	    style="verb">attribute</spanx> )</t>
	    <t hangText="shape"><spanx style="verb">( attribute {name} {value} )</spanx></t>
	  </list>
	</t>
	<t>Type: <spanx style="verb">Attribute</spanx></t>
      </section>

      <section title="xml: namespace">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x7</spanx> (mnemonic: <spanx
	    style="verb">xml:</spanx> )</t>
	    <t hangText="value"><spanx style="verb">( prefix "http://www.w3.org/XML/1998/namespace" )</spanx></t>
	  </list>
	</t>
      </section>

      <section title="xmlns: namespace">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x8</spanx> (mnemonic: <spanx
	    style="verb">xmlns:</spanx> )</t>
	    <t hangText="value"><spanx style="verb">( prefix "http://www.w3.org/2000/xmlns/" )</spanx></t>
	  </list>
	</t>
      </section>

      <section title="space preservation">
	<t>
	  <list style="hanging">
	    <t hangText="name"><spanx style="verb">0x9</spanx> (mnemonic: <spanx
	    style="verb">preserve</spanx> )</t>
	    <t hangText="value"><spanx style="verb">( attribute ( xml: "space" ) "preserve" )</spanx></t>
	  </list>
	</t>
      </section>

    </section>
  </middle>

  <back>
    <references title="Normative References">
      <reference anchor="RFC2119">
        <front>
          <title>
            Key words for use in RFCs to Indicate Requirement Levels
          </title>
          <author initials="S." surname="Bradner" fullname="Scott Bradner">
            <organization>Harvard University</organization>
            <address><email>sob@harvard.edu</email></address>
          </author>
          <date month="March" year="1997"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
      </reference>

      <reference anchor="BULK1">
	<front>
	  <title>Binary Uniform Language Kit 1.0</title>
	  <date day="7" month="August" year="2013"/>
	  <author initials="P." surname="Thierry" fullname="Pierre Thierry">
	    <organization>Thierry Technologies</organization>
	    <address>
	      <email>pierre@nothos.net</email>
	    </address>
	  </author>
	</front>
	<seriesInfo name="Internet-Draft" value="draft-thierry-bulk-02"/>
      </reference>
    </references>

    <references title="Informative references">
      <reference anchor="XML10" target="http://www.w3.org/TR/xml/">
	<front>
	  <title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>
	  <date day="26" month="November" year="2008"/>
	  <author initials="T." surname="Bray" fullname="Tim Bray">
	    <organization>Textuality and Netscape</organization>
	    <address>
	      <email>tbray@textuality.com</email>
	    </address>
	  </author>
	  <author initials="J." surname="Paoli" fullname="Jean Paoli">
	    <organization>Microsoft</organization>
	    <address>
	      <email>jeanpa@microsoft.com</email>
	    </address>
	  </author>
	  <author initials="C.M." surname="Sperberg-McQueen" fullname="C.M. Sperberg-McQueen">
	    <organization>W3C</organization>
	    <address>
	      <email>cmsmcq@w3.org</email>
	    </address>
	  </author>
	  <author initials="E." surname="Maler" fullname="Eva Maler">
	    <organization>Sun Microsystems, Inc.</organization>
	    <address>
	      <email>elm@east.sun.com</email>
	    </address>
	  </author>
	  <author initials="F." surname="Yergeau" fullname="François Yergeau"/>
	</front>
      </reference>

      <reference anchor="XML11" target="http://www.w3.org/TR/xml11/">
	<front>
	  <title>Extensible Markup Language (XML) 1.1 (Second Edition)</title>
	  <date day="16" month="August" year="2006"/>
	  <author initials="T." surname="Bray" fullname="Tim Bray">
	    <organization>Textuality and Netscape</organization>
	    <address>
	      <email>tbray@textuality.com</email>
	    </address>
	  </author>
	  <author initials="J." surname="Paoli" fullname="Jean Paoli">
	    <organization>Microsoft</organization>
	    <address>
	      <email>jeanpa@microsoft.com</email>
	    </address>
	  </author>
	  <author initials="C.M." surname="Sperberg-McQueen" fullname="C.M. Sperberg-McQueen">
	    <organization>W3C</organization>
	    <address>
	      <email>cmsmcq@w3.org</email>
	    </address>
	  </author>
	  <author initials="E." surname="Maler" fullname="Eva Maler">
	    <organization>Sun Microsystems, Inc.</organization>
	    <address>
	      <email>elm@east.sun.com</email>
	    </address>
	  </author>
	  <author initials="F." surname="Yergeau" fullname="François Yergeau"/>
	  <author initials="J." surname="Cowan" fullname="John Cowan">
	    <address>
	      <email>cowan@ccil.org</email>
	    </address>
	  </author>
	</front>
      </reference>

      <reference anchor="XML-INFOSET" target="http://www.w3.org/TR/2004/REC-xml-infoset-20040204">
	<front>
	  <title>XML Information Set (Second Edition)</title>
	  <date day="4" month="February" year="2004"/>
	  <author initials="J." surname="Cowan" fullname="John Cowan">
	    <address>
	      <email>jcowan@reutershealth.com</email>
	    </address>
	  </author>
	  <author initials="R." surname="Tobin" fullname="Richard Tobin">
	    <address>
	      <email>richard@cogsci.ed.ac.uk</email>
	    </address>
	  </author>
	</front>
      </reference>

      <reference anchor="XML-NAMES10" target="http://www.w3.org/TR/xml-names/">
	<front>
	  <title>Namespaces in XML 1.0 (Third Edition)</title>
	  <date day="8" month="December" year="2009"/>
	  <author initials="T." surname="Bray" fullname="Tim Bray">
	    <organization>Textuality</organization>
	    <address>
	      <email>tbray@textuality.com</email>
	    </address>
	  </author>
	  <author initials="D." surname="Hollander" fullname="Dave Hollander">
	    <organization>Contivo, Inc</organization>
	    <address>
	      <email>dmh@contivo.com</email>
	    </address>
	  </author>
	  <author initials="A." surname="Layman" fullname="Andrew Layman">
	    <organization>Microsoft</organization>
	    <address>
	      <email>andrewl@microsoft.com</email>
	    </address>
	  </author>
	  <author initials="R." surname="Tobin" fullname="Richard Tobin">
	    <organization>University of Edinburgh and Markup Technology Ltd</organization>
	    <address>
	      <email>richard@cogsci.ed.ac.uk</email>
	    </address>
	  </author>
	  <author initials="H.S." surname="Thompson" fullname="Henry S. Thompson">
	    <organization>University of Edinburgh and W3C</organization>
	    <address>
	      <email>ht@w3.org</email>
	    </address>
	  </author>
	</front>
      </reference>

      <reference anchor="XML-NAMES11" target="http://www.w3.org/TR/xml-names11/">
	<front>
	  <title>Namespaces in XML 1.1 (Second Edition)</title>
	  <date day="16" month="August" year="2006"/>
	  <author initials="T." surname="Bray" fullname="Tim Bray">
	    <organization>Textuality</organization>
	    <address>
	      <email>tbray@textuality.com</email>
	    </address>
	  </author>
	  <author initials="D." surname="Hollander" fullname="Dave Hollander">
	    <organization>Contivo, Inc</organization>
	    <address>
	      <email>dmh@contivo.com</email>
	    </address>
	  </author>
	  <author initials="A." surname="Layman" fullname="Andrew Layman">
	    <organization>Microsoft</organization>
	    <address>
	      <email>andrewl@microsoft.com</email>
	    </address>
	  </author>
	  <author initials="R." surname="Tobin" fullname="Richard Tobin">
	    <organization>University of Edinburgh and Markup Technology Ltd</organization>
	    <address>
	      <email>richard@cogsci.ed.ac.uk</email>
	    </address>
	  </author>
	</front>
      </reference>
    </references>

    <section title="Shorthand examples">
      <t>
	Here are a couple of examples of the kind of definitions that can be used to increase
	compactness in an XML serialization.
      </t>
      <t>
	First, this specification defines general forms for XML data. But namespaces can be
	dedicated to XML formats, with names for each element, attribute or PI:
	<list style="symbols">
	  <t><spanx style="verb">( define ?rfc ( subst ( pi "rfc" ( rest 0 ) ) ) )</spanx></t>
	  <t><spanx style="verb">( define t ( subst ( element "t" ( rest 0 ) ) ) )</spanx></t>
	</list>
      </t>
      <t>
	Secondly, recurring patterns can be abbreviated:
	<list style="symbols">
	  <t><spanx style="verb">( define thang ( subst ( t ( attribute "hangText" ( arg 0 ) ) (
	  rest 1 )</spanx></t>
	  <t><spanx style="verb">( define verb ( subst ( spanx ( attribute "verb" ) ( rest 0 ) ) ) )</spanx></t>
	</list>
      </t>
    </section>
  </back>
</rfc>