[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[syndication] Re: Automatically publish referrer data as RSS...



wkearney99 writes:
> Tedious as it seems, you have to encode those ampersands in order to 
> provide legitimate XML.  Don't feel bad, there's TONS of feeds doing 
> this wrong.

The "Canonical XML" doc got me thinking in terms of the "big 5". If I
haven't consciously allowed for encoding them, chances are good at
some point I'll be outputting something that isn't XML.

Repeat 'em with me, kids:

   amp     &
   lt      <
   gt      >
   quot    "
   apos    '

You can sometimes skip out on the last two, but it's handy to look at
code and think "have I got all *5*?", 'cause that gets pretty much all
the cases.

 And remember too, tab (0x09), carriage return (0x0d) and line feed
(0x0a) are the only control characters allowed, and any character with
a value over 127 (0x7f) needs special attention too.

Every major publisher of XML I've dealt with at some point has
violated one of those rules and caused their output to not be XML. So
if you do it, you're in good company, but the advantage of XML was
supposed to be that we weren't going to need special case parsers.

Dan