This specification defines the Escaped RDFa (eRDFa) namespace extension, an XML namespace that enables embedding RDFa metadata within HTML environments that do not natively support RDFa or extended markup tags. The eRDFa namespace provides a mechanism for escaping RDFa content so it can be preserved in constrained publishing platforms such as blogging systems.

This is a community specification under active development. Comments and contributions are welcome via the GitHub repository.

Introduction

Motivation

Many content management systems and blogging platforms strip or sanitize RDFa attributes from user-submitted HTML, preventing the publication of structured metadata. This specification addresses this limitation by defining a namespace and conventions for escaping RDFa content.

Design Goals

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

The key words MAY, MUST, MUST NOT, SHOULD, and SHOULD NOT are to be interpreted as described in [[!RFC2119]].

Namespace Declaration

Namespace URI

The eRDFa namespace URI is:

https://escaped-rdfa.github.io/namespace/docs/1.0.html#
      

Recommended Prefix

The recommended namespace prefix is eRDFa.

Declaration in HTML

The namespace MUST be declared using the RDFa prefix attribute:

<div 
  xmlns="http://www.w3.org/1999/xhtml"
  prefix="eRDFa: https://escaped-rdfa.github.io/namespace/docs/1.0.html#
          other-namespace: http://example.com/namespace#">
  <!-- content -->
</div>
      

Escaped Declaration

When the hosting platform does not support RDFa attributes, the declaration MUST be HTML-entity escaped:

&lt;div 
  xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
  prefix=&quot;eRDFa: https://escaped-rdfa.github.io/namespace/docs/1.0.html#
          other-namespace: http://example.com/namespace#&quot;&gt;
  &lt;!-- content --&gt;
&lt;/div&gt;
      

Vocabulary Terms

example

Term
eRDFa:example
Description
Indicates that the contained RDFa markup is illustrative and MUST NOT be processed as semantic data.
Usage
Applied via the rel attribute on a container element.
Processing
Processors MUST ignore all RDFa content within elements marked with rel="eRDFa:example".
<div 
  xmlns="http://www.w3.org/1999/xhtml"
  prefix="eRDFa: https://escaped-rdfa.github.io/namespace/docs/1.0.html#">
  <div rel="eRDFa:example">
    <div about="#me" vocab="http://xmlns.com/foaf/0.1/">
      <p property="name">Gregg Kellogg</p>
    </div>
  </div>
</div>
      
&lt;div 
  xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
  prefix=&quot;eRDFa: https://escaped-rdfa.github.io/namespace/docs/1.0.html#&quot;&gt;
  &lt;div rel=&quot;eRDFa:example&quot;&gt;
    &lt;div about=&quot;#me&quot; vocab=&quot;http://xmlns.com/foaf/0.1/&quot;&gt;
      &lt;p property=&quot;name&quot;&gt;Gregg Kellogg&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
      

embedded

Term
eRDFa:embedded
Description
Indicates that the contained markup is escaped RDFa that MUST be unescaped and processed as semantic data.
Usage
Applied via the rel attribute on a container element.
Processing
Processors MUST unescape HTML entities within elements marked with rel="eRDFa:embedded" and process the resulting RDFa markup.
<div 
  xmlns="http://www.w3.org/1999/xhtml"
  prefix="eRDFa: https://escaped-rdfa.github.io/namespace/docs/1.0.html#
          rss: http://purl.org/rss/1.0/
          itunes: http://www.itunes.com/dtds/podcast-1.0#">
  <div rel="eRDFa:embedded">
    <div typeof="rss:rss">
      <div rel="rss:channel">
        <div typeof="rss:item">
          <div property="rss:title" content="Episode Title"></div>
          <div property="rss:guid" content="1b593f7b-67e7-454c-bb80-32e8e32ada06"></div>
        </div>
      </div>
    </div>
  </div>
</div>
      

Processing Model

Processing Steps

An eRDFa processor MUST follow these steps:

  1. Parse the HTML document
  2. Identify elements with rel="eRDFa:example" or rel="eRDFa:embedded"
  3. For eRDFa:example elements: Skip processing of contained RDFa
  4. For eRDFa:embedded elements:
    1. Extract the text content
    2. Unescape HTML entities
    3. Parse the resulting markup as RDFa
    4. Extract triples according to RDFa processing rules

Escaping Rules

Content authors MUST escape the following characters using HTML entities:

Character Entity
< &lt;
> &gt;
" &quot;
& &amp;

Use Cases

Blogging Platforms

Platforms like Blogger and WordPress sanitize RDFa attributes. Authors can use eRDFa to embed podcast RSS metadata, FOAF profiles, or other structured data that survives the sanitization process.

Documentation and Examples

Technical documentation can use eRDFa:example to show RDFa markup examples without having them processed as actual metadata.

Security Considerations

Cross-Site Scripting (XSS)

Processors MUST sanitize unescaped content to prevent XSS attacks. Script tags and event handlers within escaped content MUST be removed or neutralized before rendering.

Content Injection

Implementations SHOULD validate that unescaped content contains only valid RDFa markup and does not include malicious HTML or JavaScript.

Privacy Considerations

Escaped RDFa may contain personal information. Publishers SHOULD be aware that escaped content, while not immediately visible, can be extracted and processed by eRDFa-aware tools.

Complete Examples

Podcast Episode Metadata

&lt;div 
  xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
  prefix=&quot;eRDFa: https://escaped-rdfa.github.io/namespace/docs/1.0.html#
          itunes: http://www.itunes.com/dtds/podcast-1.0#
          rss: http://purl.org/rss/1.0/
          dc: http://purl.org/dc/terms/&quot;&gt;
  &lt;div rel=&quot;eRDFa:embedded&quot;&gt;
    &lt;div typeof=&quot;rss:rss&quot;&gt;
      &lt;div rel=&quot;rss:channel&quot;&gt;
        &lt;div typeof=&quot;rss:item&quot;&gt;
          &lt;div property=&quot;rss:guid&quot; 
               content=&quot;1b593f7b-67e7-454c-bb80-32e8e32ada06&quot;&gt;&lt;/div&gt;
          &lt;div property=&quot;rss:pubDate&quot; 
               content=&quot;Mon, 22 Jun 2020 01:02:15 GMT&quot;&gt;&lt;/div&gt;
          &lt;div property=&quot;rss:title&quot; 
               content=&quot;StreamOfRandom S3 The Refinement EP1 Quality&quot;&gt;&lt;/div&gt;
          &lt;div property=&quot;dc:creator&quot; 
               content=&quot;Jim Dupont&quot;&gt;&lt;/div&gt;
          &lt;div property=&quot;itunes:dtdepisode&quot; 
               content=&quot;1&quot;&gt;&lt;/div&gt;
          &lt;div property=&quot;itunes:dtdseason&quot; 
               content=&quot;3&quot;&gt;&lt;/div&gt;
          &lt;div property=&quot;itunes:dtdduration&quot; 
               content=&quot;986&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
      

References

Acknowledgements

Thanks to the RDFa community and the developers of blogging platforms that inspired this work.