Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: rss feed corrupted by certain nodes (control characters)

by tye (Sage)
on May 09, 2005 at 19:43 UTC ( #455296=note: print w/replies, xml ) Need Help??

in reply to rss feed corrupted by certain nodes

Unfortunately, XML 1.0 made some stupid decisions when it comes to handling things like "control characters". It appears that XML 1.1 removes this stupidity (well, restricts it to null characters).

I've heard from at least one source that not even CDATA prevents this stupidity. I haven't tried to convince myself on this point by studying the standard but I'll note that the set of claims that I've heard from intelligent people who seem knowledgible about XML, confidently proclaimed, clearly contradict each other on the subject of how XML deals with control characters. I've sent people to go read the XML spec who returned and told me that I can use  for CTRL-A in XML (no, you can't).

I've advocated that we strip control characters from the XML we send out (by default, while allowing people to request it not be stripped, in part because so many "XML parsers" actually have no problem dealing with control characters). I don't see any other reasonable choices for what to do with control characters in PerlMonks XML, and that isn't for lack of looking; lots of different options looked promising but were eventually found unacceptable.

Until someone implements that, you can strip the control characters before you hand the "XML" to your parser. Since this is a Perl programming site, I'd hope that most visitors won't find this particularly difficult to implement. Yes, I'd rather produce fully valid XML by default.

See XML::Fling begone? for much more on this situation. Please read through that thread before replying in this thread.

- tye        

Replies are listed 'Best First'.
Re^2: rss feed corrupted by certain nodes (control characters)
by bsdz (Friar) on May 09, 2005 at 22:05 UTC
    I hadn't checked properly, but I believe you are right XML doesn't accept control characters. Removing them by default, whilst also giving the option to request them, sounds like a good solution to me.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://455296]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2023-03-23 11:04 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.