Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by tye (Cardinal)
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        


Comment on Re: rss feed corrupted by certain nodes (control characters)
Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-07-29 07:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls