Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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        


In reply to Re: rss feed corrupted by certain nodes (control characters) by tye
in thread rss feed corrupted by certain nodes by bsdz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-22 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found