Loading ...
Sorry, an error occurred while loading the content.

54

Expand Messages
  • philringnalda
    Sep 29, 2002
    • 0 Attachment
      Proposal One: Nothing Breaks, RSS Isn't For Embedding:

      [[[
      RSS2 and Namespaces:

      To maximize backward compatibility while allowing for modular
      extension through namespaces, RSS2 has the following requirements:

      * All RSS2 elements defined in this spec must be in the default
      namespace (i.e., unprefixed)

      * The default namespace must be "", that is, not namespaced. If you
      feel the need to declare a namespace, that means xmlns=""

      * All extensions must be in a namespace.

      * To avoid confusing non-namespace-aware parsers, extensions must
      not use local-name parts which are the same as RSS2 core elements.

      Thus, the following are valid fragments of RSS2 documents:

      <rss xmlns="" xmlns:foo="http://example.com/foo/">
      <channel>
      <title>The Title</title>
      <foo:heading>A Heading</foo:heading>

      or

      <rss xmlns:foo="http://example.com/foo/">
      <channel>
      <title>The Title</title>
      <foo:heading>A heading</foo:heading>

      But the following are NOT valid:

      <rss xmlns="http://backend.userland.com/RSS2"
      xmlns:foo="http://example.com/foo/">
      <channel>
      <title>The Title</title>
      <foo:heading>A Heading</foo:heading>

      <rss xmlns:foo="http://example.com/foo/">
      <channel>
      <title>The Title</title>
      <foo:title>Not a title</foo:title>
      ]]]

      Nothing breaks. Parsers will ignore elements they don't recognize
      just like they always have, whether they don't recognize things like
      <comments> because they are new, or don't recognize things like
      <foo:heading> because they are extensions.

      We lose the ability to include RSS elements in non-RSS documents,
      something that I at least haven't heard people clamoring for.

      Proposal Two: Namespace-aware Parsers Done Right Break, RSS Can Be
      Reused

      [[[
      RSS2 and Namespaces:

      The namespace for RSS2 is http://backend.userland.com/RSS2. All
      elements defined in this spec belong to that namespace, and any
      other elements used in an RSS2 document must belong to another
      namespace, and may not use the same local-name part as an RSS2 core
      element. To be a valid RSS2 document, RSS2 must be the default
      namespace, i.e. unprefixed. Thus, the following is a valid RSS2
      document fragment:

      <rss xmlns="http://backend.userland.com/RSS2"
      xmlns:foo="http://example.com/foo/">
      <channel>
      <title>The Title</title>
      <foo:heading>A Heading</foo:heading>

      while the following is NOT a valid RSS2 document:

      <rss:rss xmlns:rss="http://backend.userland.com/RSS2"
      xmlns="http://example.com/foo/">
      <rss:channel>
      <rss:title>The Title</rss:title>
      <heading>A Heading<heading>
      ]]]

      The only thing that breaks is the very best RSS parsers that have
      been written. Any namespace aware parser that has been treating RSS
      elements as "{}title", a title element without a namespace, must be
      rewritten to look for "{http://backend.userland.com/RSS2}title". In
      exchange, we get to use the rich semantics (*cough*) of RSS in other
      XML documents:

      <website xmlns="http://example.com/website"
      xmlns:rss="http://backend.userland.com/RSS2">
      <rss:title>The Title</rss:title>

      Proposal Three: The Fuzzy Solution To Shift Responsibility And Allow
      Embedding:

      [[[
      The namespace for the RSS2 core elements defined in this spec is
      http://backend.userland.com/RSS2. However, authors are cautioned
      that using that namespace will cause some existing parsers to fail
      to recognize the resulting document as RSS, and that using it as
      anything other than the default namespace (i.e., prefixing the RSS
      elements) will cause nearly all existing parsers to fail to
      recognize the document as RSS. Authors are further cautioned that
      using extensions to RSS that have elements with the same local-name
      part as RSS2 core elements will cause confusion in existing parsers.
      Thus, the following is a completely valid RSS2 document which will
      be unparsable by virtually every existing RSS parser:

      <silly:rss xmlns:silly="http://backend.userland.com/RSS2"
      xmlns:foo="http://example.com/foo/">
      <silly:channel>
      <silly:title>The Title</silly:title>
      <foo:title>Not the title</foo:title>

      Thus, best practices for RSS2 namespaces are:

      * Use RSS2 core elements unnamespaced in RSS documents, only using
      the namespace when RSS2 elements are being embedded in an XML
      document in another format

      * Avoid creating extensions that reuse RSS2 core element local-names
      in a different namespace
      ]]]

      To me, number one, which just flat out says "don't do stuff that
      will break things" is better than number three, which says "it's
      perfectly legal to do things in a way which breaks every parser out
      there, if you feel like it", but I'm sensing the tide turning that
      way.

      Phil Ringnalda