Feed Parsing

Feed Parsing

Introduction

This section is non-normative.

[342] This specification defines a set of steps that can be used to parse feeds in the wild.

[346] This specification supports feed using following formats and modules:

Data model

[15] A feed has entries, which is a list of entries, and authors, which is a list of persons. They are initially empty.

[39] A feed has page URL, feed URL, previous feed URL, next feed URL, icon, logo, and updated. They are initially null.

[226] A feed has title, subtitle, and description. They are initially null. They can be null, a string, or a Node.

[28] An entry has authors, which is a list of persons, categories, which is a set of strings, and enclosures, which is a list of enclosures. They are initially empty.

[88] An entry has feed, page URL, thumbnail, duration, published, and updated. They are initially null.

[227] An entry has title, summary, and content. They are initially null. They can be null, a string, or a Node.

[81] To get the computed authors of an entry entry, run these steps:

  1. [82] If entry's authors is not empty, return entry's authors.
  2. [83] Otherwise, if entry's feed is not null, return entry's feed's authors.
  3. [84] Otherwise, return an empty list.

[93] To get the computed updated of an entry entry, run these steps:

  1. [94] If entry's updated is not null, return entry's updated.
  2. [97] Otherwise, if entry's published is not null, return entry's published.
  3. [95] Otherwise, if entry's feed is not null, return entry's feed's updated.
  4. [96] Otherwise, return
    the current timestamp.

[29] A person is a tuple of name, email, page URL, and icon. They are initially null.

[160] An image has URL, width, and height. They are initially null.

[188] An enclosure has URL, MIME type, and length. They are initially null.

[190] Note that a MIME type might or might not be a parsible MIME type.

Parsing

[344] An implementation that supports this specification MUST use the steps to process a feed response to parse a response as a feed.

[345] An implementation that supports this specification MUST use the steps to process a feed document to parse a Document as a feed.

Namespaces

[365] The following namespaces are used in this specification:

name
Name
url
Namespace URL
name
The null namespace
url
null
name
The Atom namespace
url
http://www.w3.org/2005/Atom
name
The Atom 0.3 namespace
url
http://purl.org/atom/ns#
name
The Dublin Core namespace
url
http://purl.org/dc/elements/1.1/
name
The GData namespace
url
http://schemas.google.com/g/2005
name
The Hatena namespace
url
http://www.hatena.ne.jp/info/xmlns#
name
The HTML namespace
url
http://www.w3.org/1999/xhtml
name
The iTunes namespace
url
http://www.itunes.com/dtds/podcast-1.0.dtd or http://www.itunes.com/DTDs/Podcast-1.0.dtd
name
The Media RSS namespace
url
http://search.yahoo.com/mrss/ or http://search.yahoo.com/mrss
name
The RDF namespace
url
http://www.w3.org/1999/02/22-rdf-syntax-ns#
name
The RSS namespace
url
http://purl.org/rss/1.0/
name
The RSS content namespace
url
http://purl.org/rss/1.0/modules/content/
name
The SVG namespace
url
http://www.w3.org/2000/svg

Timestamps

[51] To process an Atom date element, run these steps:

  1. [75] Let text be element's child text content.
  2. [76] Return the result of parsing an RFC 3339 xs:dateTime string text.

[77] Need to define parse an RFC 3339 xs:dateTime string. It returns a number (JS timestamp) or null.

[166] To process a W3C-DTF date element, run these steps:

  1. [167] Let text be element's child text content.
  2. [168] Return the result of parsing a W3C-DTF string text.

[169] Need to define parse a W3C-DTF string. It returns a number (JS timestamp) or null.

[219] To process an RSS 2.0 date element, run these steps:

  1. [220] Let text be element's child text content.
  2. [221] Return the result of parsing an RFC 822 date-time string text.

[222] Need to define parse an RFC 822 date-time string. It returns a number (JS timestamp) or null.

Persons

[24] To process an Atom person element, run these steps:

  1. [54] Let person be a person.
  2. [55] For each element child in element's children, in order, run these substeps:
    1. [56] Switch by child's namespace and local name:
      name element in the Atom namespace or in the Atom 0.3 namespace
      If person's name is null, set person's name to the result of processing a string element child.
      email element in the Atom namespace or in the Atom 0.3 namespace
      If person's email is null, set person's email to the result of processing a string element child.
      uri element in the Atom namespace or in the Atom 0.3 namespace
      If person's page URL is null, set person's page URL to the result of processing a URL element child.
      image element in the GData namespace
      If person's icon is null, set person's icon to the result of processing an image element child with attribute name src.
  3. [53] Return person.

[247] To process an RSS 2.0 person element, run these steps:

  1. [254] Let person be a person.
  2. [253] Let text be element's child text content.
  3. [318] If text is the empty string:
    1. [319] Return null.
  4. [157] Otherwise, if text is one or more Unicode code points that are not space characters, followed by one or more space characters, followed by a ( character, followed by one or more Unicode code points, followed by a ) character:
    1. [158] Set person's name to the substring between ( and ) characters in text, not inclusive.
    2. [159] Set person's email to the substring before the first space character in text.
  5. [320] Otherwise:
    1. [255] Set person's name to text.
  6. [256] Return person.

Texts

[60] To process a string element element, run these steps:

  1. [98] Let text be element's child text content.
  2. [99] If text contains a Unicode code point that is not a space character:
    1. [100] Return text.
  3. [164] Otherwise:
    1. [174] Return null.

[50] To process an Atom text element, run these steps:

  1. [61] Let type be the type attribute value of element, if any, or null.
  2. [62] If type is html:
    1. [267] Return the result of parsing escaped HTML content of element.
  3. [63] Otherwise, if type is xhtml and element's children contains a div element:
    1. [66] Let div be a clone of element's first div element child, with clone children flag set.
    2. [67] Let fragment be a DocumentFragment whose node document is element's node document.
    3. [68] For each child node in div's children, in order, insert node into fragment.
    4. [104] Sanitize fragment.
    5. [105] If fragment has significant content:
      1. [69] Return fragment.
    6. [106] Otherwise:
      1. [107] Return null.
  4. [64] Otherwise:
    1. [65] Let text be element's child text content.
    2. [45] If text contains a Unicode code point that is not a space character:
      1. [46] Return text.
    3. [47] Otherwise:
      1. [48] Return null.

[102] MIME type type attribute values and src attribute of the atom:content element is not supported by these steps as they are not widely used.

[153] To process an Atom 0.3 content element, run these steps:

  1. [155] Let mode be element's mode attribute value, if any, or xml.
  2. [154] Let type be element's type attribute value, if any, or text/plain.
  3. [175] Let text be element's child text content.
  4. [162] If mode is escaped:
    1. [180] If type is equal to text/html (ASCII case-insensitive):
      1. [268] Return the result of parsing escaped HTML content of element and abort these steps.
  5. [49] If text contains a Unicode code point that is not a space character:
    1. [57] Return text.
  6. [58] Otherwise:
    1. [59] Return null.

[103] Combinations of mode and type not widely used are not supported by these steps.

[178] To parse escaped HTML content of element element, run these steps:

  1. [101] Let text be element's child text content.
  2. [73] Let div be a div element whose node document is element's node document.
  3. [74] Let fragment be a DocumentFragment whose node document is element's node document.
  4. [70] Let nodes be the result of running the HTML fragment parsing algorithm with context set to div and input set to text.
  5. [71] For each item node in nodes, in order, insert node into fragment.
  6. [108] Sanitize fragment.
  7. [109] If fragment has significant content:
    1. [339] If fragment's children contains exactly one Text:
      1. [340] Return fragment's children's first item's data.
    2. [341] Otherwise:
      1. [72] Return fragment.
  8. [110] Otherwise:
    1. [111] Return null.

[112] To sanitize Node node, run these steps:

  1. [113] If there is an img element whose width attribute value is 1 and height attribute value is 1, remove it from its parent.

[115] These steps do not remove possibly dangerous content, such as script elements. When node is used (e.g. inserted into a document), they have to be removed or sandboxed (by, e.g., sandbox attribute and CSP) such that unreliable script will not run and any fetch to a third party origin will be blocked.

[114] A Node node has significant content if there is a feed significant content inclusive descendant of node, which is not an inclusive descendant of an element matching one of the following conditions which is an inclusive descendant of node:

[129] A Node is a feed significant content if it is a palpable content and is an embedded content.

[128] As the Node objects returned by algorithms in this specification share the same node document as the input document, their base URL is the URL of the input response.

[362] Two inputs A and B are same text content iff:

  • both A and B are strings and they are equal, or
  • both A and B are Nodes and they are equal.

[363] Equality of nodes can be tested by the DOM isEqualNode method.

Entries

[262] To cleanup entry entry, run these steps:

  1. [263] If entry's page URL is not null and there is an enclosure whose URL is equal to entry's page URL in entry's enclosures:
    1. [264] Set entry's page URL to null.
  2. [332] If entry's page URL is not null, entry's thumbnail is null, and there is an enclosure whose type starts with image/ (ASCII case-insensitive) or whose type is null and URL ends by .jpeg, .jpg, or .png:
    1. [334] Let enclosure be the first such enclosure.
    2. [333] Let image be an image whose URL is enclosure's URL.
    3. [335] Remove enclosure from entry's enclosures.
  3. [265] If entry's title and entry's subtitle have same text content, set entry's subtitle to null.
  4. [266] If entry's title and entry's summary have same text content, set entry's summary to null.
  5. [291] If entry's summary and entry's content have same text content, set entry's content to null.

Atom entries

[52] To process an Atom entry element, run these steps:

  1. [78] Let entry be an entry.
  2. [79] For each element child in element's children, in order, run these substeps:
    1. [80] Switch by child's namespace and local name:
      author element in the Atom namespace or in the Atom 0.3 namespace
      Append the result of processing an Atom person child to entry's authors.
      category element in the Atom namespace
      1. [30] If child has a term attribute:
        1. [44] Let term be child's term attribute value.
        2. [89] If term is not an empty string, add term to entry's categories.
      subject element in the Dublin Core namespace
      1. [90] Let term be child's child text content.
      2. [91] If term is not an empty string, add term to entry's categories.
      published element in the Atom namespace
      If entry's published is null, set entry's published to the result of processing an Atom date child.
      created element in the Atom 0.3 namespace or in the Atom namespace
      If entry's published is null, set entry's published to the result of processing a W3C-DTF date child.
      updated element in the Atom namespace
      If entry's updated is null, set entry's updated to the result of processing an Atom date child.
      modified element in the Atom 0.3 namespace or in the Atom namespace
      If entry's updated is null, set entry's updated to the result of processing a W3C-DTF date child.
      title element in the Atom namespace
      If entry's title is null, set entry's title to the result of processing an Atom text child.
      title element in the Atom 0.3 namespace
      If entry's title is null, set entry's title to the result of processing an Atom 0.3 content child.
      summary element in the Atom namespace
      If entry's summary is null, set entry's summary to the result of processing an Atom text child.
      summary element in the Atom 0.3 namespace
      If entry's summary is null, set entry's summary to the result of processing an Atom 0.3 content child.
      content element in the Atom namespace
      If entry's content is null, set entry's content to the result of processing an Atom text child.
      content element in the Atom 0.3 namespace
      If entry's content is null, set entry's content to the result of processing an Atom 0.3 content child.
      link element in the Atom namespace or in the Atom 0.3 namespace
      Process an Atom link child for entry, with type entry.
      thumbnail element in the Media RSS namespace
      If entry's thumbnail is null, set entry's thumbnail to the result of processing an image element child with attribute name url.
      group element in the Media RSS namespace
      1. [116] For each element gc in child's children, in order, run these substeps:
        1. [117] Switch by gc's namespace and local name:
          title element in the Media RSS namespace
          If entry's title is null, set entry's title to the result of processing a string element gc.
          description element in the Media RSS namespace
          If entry's summary is null, set entry's summary to the result of processing a string element gc.
          thumbnail element in the Media RSS namespace
          If entry's thumbnail is null, set entry's thumbnail to the result of processing an image element child with attribute name url.
          content element in the Media RSS namespace
          1. [123] Let enclosure be an enclosure.
          2. [124] Let text be gc's url attribute value.
          3. [125] If text is not null or the empty string:
            1. [126] Parse text relative to gc's node document.
            2. [127] If not failed:
              1. [163] Set enclosure's URL to the resulting URL string.
              2. [165] Set enclosure's type to gc's type attribute value.
              3. [171] Append enclosure to object's enclosures.
  3. [246] Return entry.

RSS 2.0 and RSS 0.9x items

[249] To process an RSS 2.0 item element, run these steps:

  1. [248] Let entry be an entry.
  2. [250] For each element child in element's children, in order, run these substeps:
    1. [251] Switch by child's namespace and local name:
      category element in the null namespace
      1. [92] Let term be child's child text content.
      2. [293] If term is not the empty string, add term to entry's categories.
      author element in the null namespace
      1. [355] Let person be the result of processing an RSS 2.0 person child.
      2. [361] If person is not null:
        1. [356] If person's email is not null, or if there is no person whose name is person's name in entry's authors:
          1. [354] Append person to entry's authors.
      creator element in the Dublin Core namespace or author element in the iTunes namespace
      1. [118] Let text be element's child text content.
      2. [119] If text is not the empty string and there is no person whose name is text in entry's authors:
        1. [120] Append a person whose name is text to entry's authors.
      pubDate element in the null namespace
      If entry's published is null, set entry's published to the result of processing an RSS 2.0 date child.
      updated element in the Atom namespace
      If entry's updated is null, set entry's updated to the result of processing an Atom date child.
      link element in the null namespace
      If entry's page URL is null, set entry's page URL to the result of processing a URL element child.
      thumbnail element in the Media RSS namespace
      If entry's thumbnail is null, set entry's thumbnail to the result of processing an image element child with attribute name url.
      image element in the iTunes namespace
      If entry's thumbnail is null, set entry's thumbnail to the result of processing an image element child with attribute name href.
      content element in the Media RSS namespace
      1. [292] Let enclosure be an enclosure.
      2. [364] Let text be child's url attribute value.
      3. [366] If text is not null or the empty string:
        1. [367] Parse text relative to child's node document.
        2. [368] If not failed:
          1. [369] Set enclosure's URL to the resulting URL string.
          2. [370] Set enclosure's type to child's type attribute value.
          3. [371] Append enclosure to object's enclosures.
      enclosure element in the null namespace
      1. [279] Let enclosure be an enclosure.
      2. [280] Let text be child's url attribute value.
      3. [281] If text is not null or the empty string:
        1. [282] Parse text relative to child's node document.
        2. [283] If not failed:
          1. [195] Set enclosure's URL to the resulting URL string.
          2. [284] Set enclosure's type to child's type attribute value.
          3. [285] Let length be child's length attribute value.
          4. [286] If length is not null:
            1. [287] Let n be the result of applying the rules for parsing non-negative integers to length.
            2. [288] If n is not an error and n is greater than zero:
              1. [289] Set enclosure's length to n.
          5. [290] Append enclosure to object's enclosures.
      title element in the null namespace
      If entry's title is null, set entry's title to the result of processing a string element child.
      subtitle element in the iTunes namespace
      If entry's subtitle is null, set entry's subtitle to the result of processing a string element child.
      description element in the null namespace
      If entry's summary is null, set entry's summary to the result of parsing escaped HTML content of child.
      summary element in the iTunes namespace
      If entry's subtitle is null, set entry's subtitle to the result of processing a string element child.
      encoded element in the RSS content namespace
      If entry's content is null, set entry's content to the result of parsing escaped HTML content of child.
      duration element in the iTunes namespace
      1. [218] If entry's duration is not null:
        1. [198] Let text be child's child text content.
        2. [212] If text is one or more ASCII digits:
          1. [217] Set entry's duration to the ASCII digits in text, interpreted as a decimal number.
        3. [215] Otherwise, if text is one or more ASCII digits, followed by a : character, followed by one or more ASCII digits:
          1. [223] Set m to the first sequence of ASCII digits in text, interpreted as a decimal number.
          2. [224] Set s to the second sequence of ASCII digits in text, interpreted as a decimal number.
          3. [230] Set entry's duration to m × 60 + s.
        4. [216] Otherwise, if text is one or more ASCII digits, followed by a : character, followed by one or more ASCII digits, followed by a : character, followed by one or more ASCII digits:
          1. [231] Set h to the first sequence of ASCII digits in text, interpreted as a decimal number.
          2. [232] Set m to the second sequence of ASCII digits in text, interpreted as a decimal number.
          3. [233] Set s to the third sequence of ASCII digits in text, interpreted as a decimal number.
          4. [257] Set entry's duration to h × 3600 + m × 60 + s.
  3. [252] Return entry.

RSS 1.0 items

[322] To process an RSS 1.0 item element, run these steps:

  1. [323] Let entry be an entry.
  2. [324] For each element child in element's children, in order, run these substeps:
    1. [325] Switch by child's namespace and local name:
      link element in the RSS namespace
      If entry's page URL is null, set entry's page URL to the result of processing a URL element child.
      imageurl element in the Hatena namespace
      1. [189] If entry's thumbnail is null:
        1. [191] Set url to the result of processing a URL element child.
        2. [192] If url is not null:
          1. [193] Let image be an image whose URL is url.
          2. [194] Set entry's thumbnail to image.
      creator element in the Dublin Core namespace
      1. [121] Let text be element's child text content.
      2. [122] If text is not the empty string:
      3. [356] If person's email is not null and there is no person whose name is text in entry's authors:
        1. [338] Append a person whose name is text to entry's authors.
      date element in the Dublin Core namespace
      If entry's updated is null, set entry's updated to the result of processing a W3C-DTF date child.
      subject element in the Dublin Core namespace
      1. [294] Let term be child's child text content.
      2. [295] If term is not the empty string, add term to entry's categories.
      title element in the RSS namespace
      If entry's title is null, set entry's title to the result of processing a string element child.
      description element in the RSS namespace
      If entry's summary is null, set entry's summary to the result of parsing escaped HTML content of element.
      encoded element in the RSS content namespace
      If entry's content is null, set entry's content to the result of parsing escaped HTML content of element.
  3. [343] Return entry.

Feeds

[1] To process a feed response res, run these steps:

  1. [9] If res is a network error or res's status is not 200, return null and abort these steps.
  2. [2] Let type be res's computed MIME type.
  3. [3] If type is an XML MIME type:
    1. [7] Let doc be a Document.
    2. [6] Let parser be an XML parser associated with doc. The XML parser MUST implement XML5. It MUST NOT fetch and process external entities.
    3. [8] Run parser, using res's body as its input byte stream. The charset parameter value in the Content-Type header value of res, if any, is used as the encoding label provided by the underlying transport.
    4. [11] Set doc's address to res's url.
    5. [27] Set doc's character encoding to the character encoding used by parser.
    6. [5] Return the result of processing a feed document doc.
  4. [4] Otherwise, return null.

[33] Scripting is disabled as the document is not in any browsing context.

[10] To process a feed document doc, run these steps:

  1. [12] Let root be doc's root element.
  2. [17] Switch by root:
    [16] If it is a feed element in the Atom namespace or in the Atom 0.3 namespace
    Let feed be the result of processing an Atom feed element root.
    [19] If it is an rss element in the null namespace
    Let feed be the result of processing an rss element root.
    [18] If it is an RDF element in the RDF namespace
    Let feed be the result of processing an RDF element root.
  3. [350] If feed is not null, cleanup feed feed.
  4. [13] Return feed.

[351] To cleanup feed feed, run these steps:

  1. [352] If feed's logo is not null, feed's icon is not null, and feed's logo's URL is feed's icon's URL:
    1. [353] Set feed's icon to null.

Atom feeds

[20] To process an Atom feed element element, run these steps:

  1. [14] Let feed be a feed.
  2. [21] For each element child in element's children, in order, run these substeps:
    1. [22] Switch by child's namespace and local name:
      title element in the Atom namespace
      If feed's title is null, set feed's title to the result of processing an Atom text child.
      title element in the Atom 0.3 namespace
      If feed's title is null, set feed's title to the result of processing an Atom 0.3 content child.
      subtitle element in the Atom namespace
      If feed's subtitle is null, set feed's subtitle to the result of processing an Atom text child.
      tagline element in the Atom 0.3 namespace
      If feed's subtitle is null, set feed's subtitle to the result of processing an Atom 0.3 content child.
      updated element in the Atom namespace
      If feed's updated is null, set feed's updated to the result of processing an Atom date child.
      modified element in the Atom 0.3 namespace or in the Atom namespace
      If feed's updated is null, set feed's updated to the result of processing a W3C-DTF date child.
      link element in the Atom namespace or in the Atom 0.3 namespace
      Process an Atom link child for feed, with type feed.
      icon element in the Atom namespace
      1. [181] If feed's icon is null:
        1. [184] Let image be an image.
        2. [183] Set image's URL to the result of processing a URL element child.
        3. [182] If image's URL is not null, set feed's icon to image.
      logo element in the Atom namespace
      1. [185] If feed's logo URL is null:
        1. [186] Let image be an image.
        2. [197] Set image's URL to the result of processing a URL element child.
        3. [225] If image's URL is not null, set feed's logo to image.
      author element in the Atom namespace or in the Atom 0.3 namespace
      Append the result of processing an Atom person child to feed's authors.
      entry element in the Atom namespace or in the Atom 0.3 namespace
      1. [86] Let entry be the result of processing an Atom entry child.
      2. [85] Set entry's feed to feed.
      3. [258] Cleanup entry entry.
      4. [87] Append entry to feed's entries.
  3. [25] Return feed.

RSS 2.0 and RSS 0.9x feeds

[301] To process an rss element element, run these steps:

  1. [239] Let feed be a feed.
  2. [240] For each element child in element's children, in order, run these substeps:
    1. [302] Switch by child's namespace and local name:
      channel element in the null namespace
      Process an RSS 2.0 channel element with feed.
      item element in the null namespace
      1. [242] Let entry be the result of processing an RSS 2.0 item child.
      2. [243] Set entry's feed to feed.
      3. [259] Cleanup entry entry.
      4. [244] Append entry to feed's entries.
  3. [245] Return feed.

[206] To process an RSS 2.0 channel element with feed feed, run these steps:

  1. [208] For each element child in element's children, in order, run these substeps:
    1. [209] Switch by child's namespace and local name:
      image element in the null namespace
      1. [211] If feed's logo is null:
        1. [213] Let element be child's first url child element in the null namespace.
        2. [214] If element is not null:
          1. [308] Let url be the result of processing a URL element element.
          2. [37] If url is not null:
            1. [310] Let image be an image.
            2. [314] Set image's URL to url.
            3. [309] Set feed's logo to image.
      image element in the iTunes namespace
      If feed's icon is null, set feed's icon to the result of processing an image element child with attribute name href.
      creator element in the Dublin Core namespace or author element in the iTunes namespace
      1. [316] Let text be element's child text content.
      2. [317] If text is not the empty string and there is no person whose name is text in feed's authors:
        1. [315] Append a person whose name is text to feed's authors.
      managingEditor element in the null namespace
      1. [357] Let person be the result of processing an RSS 2.0 person child.
      2. [360] If person is not null:
        1. [358] If person's email is not null, or if there is no person whose name is person's name in feed's authors:
          1. [359] Append person to feed's authors.
      pubDate or lastBuildDate element in the null namespace
      If feed's updated is null, set feed's updated to the result of processing an RSS 2.0 date child.
      title element in the null namespace
      If feed's title is null, set feed's title to the result of processing a string element child.
      subtitle element in the iTunes namespace
      If feed's subtitle is null, set feed's subtitle to the result of processing a string element child.
      description element in the null namespace or summary element in the iTunes namespace
      If feed's description is null, set feed's description to the result of processing a string element child.
      link element in the null namespace
      If feed's page URL is null, set feed's page URL to the result of processing a URL element child.
      link element in the Atom namespace
      Process an Atom link child for feed, with type feed.
      item element in the null namespace
      1. [147] Let entry be the result of processing an RSS 2.0 item child.
      2. [148] Set entry's feed to feed.
      3. [261] Cleanup entry entry.
      4. [149] Append entry to feed's entries.

RSS 1.0 feeds

[207] To process an RDF element element, run these steps:

  1. [238] Let feed be a feed.
  2. [210] For each element child in element's children, in order, run these substeps:
    1. [236] Switch by child's namespace and local name:
      channel element in the RSS namespace
      Process an RSS 1.0 channel element with feed.
      item element in the RSS namespace
      1. [237] Let entry be the result of processing an RSS 1.0 item child.
      2. [241] Set entry's feed to feed.
      3. [260] Cleanup entry entry.
      4. [303] Append entry to feed's entries.
      image element in the RSS namespace
      1. [305] If feed's logo is null:
        1. [40] Let element be child's first url child element in the RSS namespace.
        2. [306] If element is not null:
          1. [307] Let url be the result of processing a URL element element.
          2. [321] If url is not null:
            1. [326] Let image be an image.
            2. [327] Set image's URL to url.
            3. [328] Set feed's logo to image.
  3. [304] Return feed.

[311] To process an RSS 1.0 channel element with feed feed, run these steps:

  1. [312] For each element child in element's children, in order, run these substeps:
    1. [313] Switch by child's namespace and local name:
      date element in the Dublin Core namespace
      If feed's updated is null, set feed's updated to the result of processing a W3C-DTF date child.
      creator element in the Dublin Core namespace
      1. [329] Let text be element's child text content.
      2. [330] If text is not the empty string and there is no person whose name is text in feed's authors:
        1. [331] Append a person whose name is text to feed's authors.
      title element in the RSS namespace
      If feed's title is null, set feed's title to the result of processing a string element child.
      description element in the RSS namespace
      If feed's description is null, set feed's description to the result of processing a string element child.
      link element in the RSS namespace
      If feed's page URL is null, set feed's page URL to the result of processing a URL element child.
      link element in the Atom namespace
      Process an Atom link child for feed, with type feed.

References

[43] The key word MUST is defined by RFC 2119.

[34] The terms ASCII digits and URL record are defined by the URL Standard.

[42] The terms MIME type, computed MIME type, type, and parse a MIME type are defined by the MIME Sniffing Standard.

[41] The terms response, status, url, and network error are defined by the Fetch Standard.

[26] The interfaces Node and DocumentFragment are defined by the DOM Standard.

[31] The terms parent, children, inclusive descendant, insert, remove, clone, equals (of Nodes), local name, namespace, and node document are defined by the DOM Standard.

[23] The terms XML MIME type, Unicode code point, space characters, ASCII case-insensitive, parse a URL, resulting URL string, resulting URL string, rules for parsing non-negative integers, document's address, document's character encoding, palpable content, embedded content, child text content, input byte stream, HTML fragment parsing algorithm, HTML parser, and XML parser are defined by the HTML Standard.

[32] The div and img elements are defined by the HTML Standard.

Tests

[348] Test data are available at: <https://github.com/wakaba/tests-web/tree/master/feed/parsing>.

License

[347] Per CC0 <https://creativecommons.org/publicdomain/zero/1.0/>, to the extent possible under law, the author of this specification has waived all copyright and related or neighboring rights to this specification.

Notes

[349] There is an implementation: <https://manakai.github.io/pod/Web/Feed/Parser>.