Avoid being called a bozo when producing xml

Comments

[gravatar]
do you get many of your links from del.icio.us?
[gravatar]
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]
djQuickTip: No, I've never made del.icio.us part of my habitual routine. Why do you ask?
[gravatar]
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]
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]
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]
Well, yes, I do use, for example StringEscapeUtils.escapeXml from apache commons.
[gravatar]
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:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.