Comments

[gravatar]
djQuickTip 2:06 AM on 28 Sep 2005

do you get many of your links from del.icio.us?

[gravatar]
Pete 8:32 AM on 28 Sep 2005

The final advice in "Avoid adding pretty-printing white space in character data" seems pretty crazy to me. I guess it's legal XML but if the idea is to make the XML more readable it fails miserably. Better advice would have been to just don't do it and create a style sheet.

[gravatar]
Ned Batchelder 9:32 AM on 28 Sep 2005

djQuickTip: No, I've never made del.icio.us part of my habitual routine. Why do you ask?

[gravatar]
Ned Batchelder 9:34 AM on 28 Sep 2005

Pete: I agree with you. I've never seen XML formatted as he suggests. I've split an element across multiple lines, but the reason was to spread out its attributes so I could see them better, no so that the character content would be indented.

[gravatar]
Sea McEligot 12:37 PM on 30 Sep 2005

There are alot of people out there who advocate a very bloated, combersome, do everything, XML world view. If you take this persons advices you will have an unmanageable nightmare. I suggest that you validate your XML, but make sure it's readable, and keep it simple. Don't use an XML library, do print.

[gravatar]
Ned Batchelder 1:39 PM on 30 Sep 2005

Sean: I have to disagree: if you use print to create XML, you'll spend the rest of the lifetime of the product chasing down quoting bugs. Use a simple XML streamer.

[gravatar]
Sea McEligot 2:55 PM on 30 Sep 2005

Well, yes, I do use, for example StringEscapeUtils.escapeXml from apache commons.

[gravatar]
Fredrik 10:26 AM on 1 Oct 2005

If you find yourself having to explicitly escape stuff all the time, maybe you're printing the wrong things:

http://arctrix.com/nas/talks/htmltext.pdf

Add a comment:

name
email
Ignore this:
not displayed and no spam.
Leave this empty:
www
not searched.
 
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.