Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator inappropriately constrains foreign markup in Atom [DuplicateElement and UndefinedElement] #73

Open
pa-tna opened this issue Feb 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@pa-tna
Copy link

pa-tna commented Feb 11, 2022

Describe the bug
According to section 4.1.2 of the Atom syndication format RFC, the atom:entry element allows zero or more "extension elements". The RFC defines "extension elements" in section 6.4 as "foreign markup", which it defines in section 6.1 as "markup from other vocabularies" i.e. not in the Atom namespace). In section 6.4, the RFC says in full:

Atom allows foreign markup anywhere in an Atom document, except where it is explicitly forbidden. Child elements of atom:entry, atom:feed, atom:source, and Person constructs are considered Metadata elements and are described below. Child elements of Person constructs are considered to apply to the construct. The role of other foreign markup is undefined by this specification.

However, when providing an Atom feed containing an atom:entry with more than one dc:language child element, the validator reports the error:

entry contains more than one dc:language [help]

with a link to the DuplicateElement help page.

If instead the Atom feed provided contains more than one dct:language child element, the validator reports the error:

Undefined entry element: dcterms:language (2 occurrences) [help]

with a link to the [UndefinedElement] help page.

To Reproduce

To trigger the DuplicateElement error, paste the following feed into the direct input box on the page :

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <id>http://example.com/data.feed</id>
  <title>Test feed</title>
  <updated>2022-02-11T15:21:00Z</updated>
  <link rel="self" href="http://example.com/data.feed"/>
  <author><name>example.com</name></author>
  <entry>
  <id>http://example.com/item/1</id>
    <title type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <span xml:lang="en">Test title</span> / 
        <span xml:lang="cy">Teitl enghreifftiol</span>
      </div>
    </title>
    <summary type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <span xml:lang="en">Summary</span> / 
        <span xml:lang="cy">Crynodeb</span>
      </div>
    </summary>
    <link rel="alternate" href="http://example.com/item/1.json" type="application/json"/>
    <link rel="alternate" href="http://example.com/item/1.xml" type="application/xml"/>
    <updated>2022-02-11T15:22:00Z</updated>
    <dc:language>en</dc:language>
    <dc:language>cy</dc:language>
  </entry>
</feed>

To trigger the UndefinedElement.html error, delete both instances of dc:language in the above XML and substitute the below XML:

    <dct:language>en</dct:language>
    <dct:language>cy</dct:language>

Expected behavior
The feed validates if an atom:entry contains two or more dc:language or dct:language elements.

@pa-tna pa-tna added the bug Something isn't working label Feb 11, 2022
@pa-tna pa-tna changed the title Validator inappropriately constrains foreign markup in Atom [DuplicateElement] Validator inappropriately constrains foreign markup in Atom [DuplicateElement and UndefinedElement] Feb 11, 2022
@pa-tna
Copy link
Author

pa-tna commented Feb 14, 2022

(I missed out the xmlns:dct="http://purl.org/dc/terms/" namespace declaration in the above example, but with it present the problem above still occurs)

@abiiget
Copy link

abiiget commented Aug 23, 2023

Describe the bug
According to section 4.1.2 of the Atom syndication format RFC, the atom:entry element allows zero or more "extension elements". The RFC defines "extension elements" in section 6.4 as "foreign markup", which it defines in section 6.1 as "markup from other vocabularies" i.e. not in the Atom namespace). In section 6.4, the RFC says in full:

Atom allows foreign markup anywhere in an Atom document, except where it is explicitly forbidden. Child elements of atom:entry, atom:feed, atom:source, and Person constructs are considered Metadata elements and are described below. Child elements of Person constructs are considered to apply to the construct. The role of other foreign markup is undefined by this specification.

However, when providing an Atom feed containing an atom:entry with more than one dc:language child element, the validator reports the error:

entry contains more than one dc:language [help]

with a link to the DuplicateElement help page.

If instead the Atom feed provided contains more than one dct:language child element, the validator reports the error:

Undefined entry element: dcterms:language (2 occurrences) [help]

with a link to the [UndefinedElement] help page.

To Reproduce

To trigger the DuplicateElement error, paste the following feed into the direct input box on the page :

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <id>http://example.com/data.feed</id>
  <title>Test feed</title>
  <updated>2022-02-11T15:21:00Z</updated>
  <link rel="self" href="http://example.com/data.feed"/>
  <author><name>example.com</name></author>
  <entry>
  <id>http://example.com/item/1</id>
    <title type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <span xml:lang="en">Test title</span> / 
        <span xml:lang="cy">Teitl enghreifftiol</span>
      </div>
    </title>
    <summary type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <span xml:lang="en">Summary</span> / 
        <span xml:lang="cy">Crynodeb</span>
      </div>
    </summary>
    <link rel="alternate" href="http://example.com/item/1.json" type="application/json"/>
    <link rel="alternate" href="http://example.com/item/1.xml" type="application/xml"/>
    <updated>2022-02-11T15:22:00Z</updated>
    <dc:language>en</dc:language>
    <dc:language>cy</dc:language>
  </entry>
</feed>

To trigger the UndefinedElement.html error, delete both instances of dc:language in the above XML and substitute the below XML:

    <dct:language>en</dct:language>
    <dct:language>cy</dct:language>

Expected behavior
The feed validates if an atom:entry contains two or more dc:language or dct:language elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants