mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-21 08:45:04 -05:00
0.0.1
This commit is contained in:
parent
818557f06a
commit
9851cce546
111
inbox/json-containers.xml
Normal file
111
inbox/json-containers.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE xep SYSTEM 'xep.dtd' [
|
||||
<!ENTITY % ents SYSTEM 'xep.ent'>
|
||||
%ents;
|
||||
]>
|
||||
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
|
||||
<xep>
|
||||
<header>
|
||||
<title>JSON Containers</title>
|
||||
<abstract>This specification defines an element to be used for encapsulating JSON data in XMPP.</abstract>
|
||||
<legal>
|
||||
<copyright>This XMPP Extension Protocol is copyright (c) 1999 - 2012 by the XMPP Standards Foundation (XSF).</copyright>
|
||||
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
|
||||
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. In no event shall the XMPP Standards Foundation or the authors of this Specification be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification. ##</warranty>
|
||||
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising out of the use or inability to use the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
|
||||
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which may be found at <<link url='http://www.xmpp.org/extensions/ipr-policy.shtml'>http://www.xmpp.org/extensions/ipr-policy.shtml</link>> or obtained by writing to XSF, P.O. Box 1641, Denver, CO 80201 USA).</conformance>
|
||||
</legal>
|
||||
<number>xxxx</number>
|
||||
<status>ProtoXEP</status>
|
||||
<type>Standards Track</type>
|
||||
<sig>Standards</sig>
|
||||
<approver>Council</approver>
|
||||
<dependencies>
|
||||
<spec>XMPP Core</spec>
|
||||
</dependencies>
|
||||
<supersedes/>
|
||||
<supersededby/>
|
||||
<shortname>NOT_YET_ASSIGNED</shortname>
|
||||
&mwild;
|
||||
<revision>
|
||||
<version>0.0.1</version>
|
||||
<date>2012-11-15</date>
|
||||
<initials>mw</initials>
|
||||
<remark><p>First draft.</p></remark>
|
||||
</revision>
|
||||
</header>
|
||||
<section1 topic='Introduction' anchor='intro'>
|
||||
<p><link url='http://json.org/'>JSON</link> is an increasingly popular format for data representation. While investigation has shown us that it cannot feasibly replace XML in all its uses (&xep0295;) sometimes existing data is already in JSON or it is necessary to integrate with systems that use JSON while avoiding the overhead of marshalling that data to or from XML.</p>
|
||||
<p>Traditional approaches have ranged from simply placing the XML into existing freeform text containers in XMPP (such as the message <body> tag or the presence <status> tag) to creating dedicated containers in a custom namespace. Neither of these approaches are ideal for preserving the extensibility or interoperability that XMPP provides.</p>
|
||||
<p>This document aims to solve the problem by defining a standard way to embed JSON into any XMPP stanza, and even allowing its use with existing XMPP protocols where possible.</p>
|
||||
</section1>
|
||||
<section1 topic='Requirements' anchor='reqs'>
|
||||
<p>This specication should:</p>
|
||||
<ul>
|
||||
<li>Allow stanza generators to unambiguously embed JSON within their stanzas.</li>
|
||||
<li>Allow stanza recipients a way to identify JSON content, and thus also validation.</li>
|
||||
</ul>
|
||||
</section1>
|
||||
<section1 topic='Use Cases' anchor='usecases'>
|
||||
<p>Since JSON generally isn't designed for end-user presentation, most use-cases centre around JSON as part of machine-to-machine communication, or as part of a higher protocol.</p>
|
||||
<example caption='Sending JSON inside a message'><![CDATA[
|
||||
<message to="recipient@example.com" from="sender@example.com">
|
||||
<json xmlns="urn:xmpp:json:tmp">
|
||||
{ "name": "romeo", "age": "421", "status": "single" }
|
||||
</json>
|
||||
</message>
|
||||
]]></example>
|
||||
|
||||
<p>Outside of closed systems, it is much more desirable to place the JSON element within some greater context, for example as part of another protocol.</p>
|
||||
<example caption='Sending JSON as part of another protocol'><![CDATA[
|
||||
<iq to="recipient.example.com" type="get" id="q1">
|
||||
<query xmlns="http://example.com/user-queries">
|
||||
<json xmlns="urn:xmpp:json:tmp">
|
||||
{ "name": "romeo" }
|
||||
</json>
|
||||
</query>
|
||||
</iq>
|
||||
]]></example>
|
||||
|
||||
</section1>
|
||||
<section1 topic='Business Rules' anchor='rules'>
|
||||
<p>The <json> element MUST only contain character data, and the data MUST conform to the <link url='http://json.org/'>JSON specification</link>. Specifically, the element MUST NOT be empty, as the empty string is not valid JSON. The data MUST be encoded as UTF-8 (though officially unspecified, this is the de facto encoding for JSON today).</p>
|
||||
<p>Implementations SHOULD validate JSON they receive and intend to use, and be prepared to handle invalid data appropriately (such as by responding to the sender with the applicable XMPP error reply for the stanza type).</p>
|
||||
</section1>
|
||||
<section1 topic='Implementation Notes' anchor='notes'>
|
||||
<p>The JSON container element is intended for communicating small pieces of generic JSON data within a particular context. XMPP entities MUST NOT attempt to interpret unexpected JSON data they receive, and servers SHOULD NOT inspect JSON data inside stanzas they are routing, other than for OPTIONAL validation.</p>
|
||||
<p>When generating stanzas containing JSON payloads, implementations should be aware of the maximum stanza size considerations laid down in &xmppcore;.</p>
|
||||
<p>Embedding JSON is not intended as a substitute for the use of XML in XMPP, and no attempt should be made by protocol designers to use it as such. XMPP implementations are optimised for XML processing, and introducing mixed-format protocols on top of existing XMPP constructs could lead to performance and security considerations beyond the scope of this document.</p>
|
||||
</section1>
|
||||
<section1 topic='Security Considerations' anchor='security'>
|
||||
<p>JSON is a very common format for data interchange today, and has many popular implementations available in browsers and standalone libraries that can be assumed relatively well-tested. However an implementation receiving JSON data from an untrusted entity should take precautions and MUST NOT attempt to use invalid JSON data it receives in any way, nor must it accept data in any encoding other than UTF-8 to avoid potential encoding mismatch attacks.</p>
|
||||
</section1>
|
||||
<section1 topic='IANA Considerations' anchor='iana'>
|
||||
<p>N/A.</p>
|
||||
</section1>
|
||||
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
|
||||
<p>TBD.</p>
|
||||
</section1>
|
||||
<section1 topic='XML Schema' anchor='schema'>
|
||||
<p>This schema is descriptive, not normative.</p>
|
||||
<code><![CDATA[
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
|
||||
<xs:schema
|
||||
xmlns:xs='http://www.w3.org/2001/XMLSchema'
|
||||
targetNamespace='urn:xmpp:json:tmp'
|
||||
xmlns='urn:xmpp:json:tmp'
|
||||
elementFormDefault='qualified'>
|
||||
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
The protocol documented by this schema is defined in
|
||||
XEP-xxxx: http://www.xmpp.org/extensions/xep-xxxx.html
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
<xs:element name='json' type='xs:string' minOccurs='0' maxOccurs='unbounded'/>
|
||||
</xs:schema>
|
||||
]]></code>
|
||||
</section1>
|
||||
</xep>
|
Loading…
Reference in New Issue
Block a user