<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Data Forms XML Element</title>
  <abstract>This specification defines an XMPP protocol extension for including XML-data in XEP-0004 data forms.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (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. ##</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 from, out of, or in connection with the Specification or the implementation, deployment, or other use of 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 can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0315</number>
  <status>Deferred</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0004</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>xml-element</shortname>
  <author>
    <firstname>Sergey</firstname>
    <surname>Dobrov</surname>
    <email>binary@jrudevels.org</email>
    <jid>binary@jrudevels.org</jid>
    <uri>http://jrudevels.org/</uri>
  </author>
  <revision>
    <version>0.1.1</version>
    <date>2019-06-19</date>
    <initials>fs</initials>
    <remark><p>Fix shortname and section heading to avoid collision with XEP-0221</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2012-10-15</date>
    <initials>psa</initials>
    <remark><p>Initial published version approved for publication by the XMPP Council.</p></remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2012-06-21</date>
    <initials>snd</initials>
    <remark><p>Root element name changed to "wrapper"; xmlns fixed in the XML-schema.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2012-06-13</date>
    <initials>snd</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
</header>

<section1 topic="Introduction" anchor="intro">
  <p>In certain protocols that make use of <span class="ref"><link url="https://xmpp.org/extensions/xep-0004.html">Data Forms (XEP-0004)</link></span> <note>XEP-0004: Data Forms &lt;<link url="https://xmpp.org/extensions/xep-0004.html">https://xmpp.org/extensions/xep-0004.html</link>&gt;.</note>, it can be helpful to include XML-data (for example, when we want to insert a big amount of structured data which is hard to insert as a separate fields). This document defines a method for including XML-data in a data form.</p>
</section1>

<section1 topic="XML Element" anchor="xml-element">
  <p>The root element for XML-data is &lt;wrapper/&gt;. This element MUST be qualified by the "urn:xmpp:xml-element" namespace. The &lt;wrapper/&gt; element MUST be contained within a &lt;field/&gt; element qualified by the 'jabber:x:data' namespace.</p>
  <p>The &lt;wrapper/&gt; element SHOULD contain an XML-data which needs to be represented in a form.</p>
  <example caption="PubSub Blog Node Metadata"><![CDATA[
<wrapper xmlns='urn:xmpp:xml-element'>
  <feed xmlns='http://www.w3.org/2005/Atom'>
    <title>Romeo&amp;apos;s Microblog</title>
    <id>tag:montague.lit,2008:home</id>
    <updated>2008-05-08T18:30:02Z</updated>
    <author>
      <name>Romeo Montague</name>
      <uri>xmpp:romeo@montague.lit</uri>
    </author>
  </feed>
</wrapper>
]]></example>
  <example caption="Inclusion in Data Form"><![CDATA[
<x xmlns='jabber:x:data' type='form'>
  [ ... ]
  <field var='xml-metadata' type='hidden'>
    <wrapper xmlns='urn:xmpp:xml-element'>
      <feed xmlns='http://www.w3.org/2005/Atom'>
        <title>Romeo&amp;apos;s Microblog</title>
        <id>tag:montague.lit,2008:home</id>
        <updated>2008-05-08T18:30:02Z</updated>
        <author>
          <name>Romeo Montague</name>
          <uri>xmpp:romeo@montague.lit</uri>
        </author>
      </feed>
    </wrapper>
  </field>
  [ ... ]
</x>
]]></example>
</section1>

<section1 topic="Usage Practices">
  <p>XML-data is usually hard for manual editing and SHOULD be used only for machine level iteractions. So it's RECOMMENDED to include it in the form as a "hidden" field.</p>
  <p>However, there are situations when human editing of XML-data may be useful (for example, to see XML-logs of some XMPP-service). In that case it's RECOMMENDED for a client to represent this XML in a pretty formatted form and give an instruments to make it easier to edit XML-data.</p>
</section1>

<section1 topic="IANA Considerations" anchor="iana">
  <p>This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>

<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <section2 topic="Protocol Namespaces" anchor="ns">
    <p>The <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> includes "urn:xmpp:xml-element" in its registry of protocol namespaces (see &lt;<link url="https://xmpp.org/registrar/namespaces.html">https://xmpp.org/registrar/namespaces.html</link>&gt;).</p>
  </section2>
</section1>

<section1 topic="XML Schema" anchor="schema">
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:xml-element'
    xmlns='urn:xmpp:xml-element'
    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='wrapper'>
    <xs:complexType>
      <xs:sequence>
        <xs:any minOccurs='0' maxOccurs='unbounded'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
]]></code>
</section1>

</xep>
