XML
How to quickly and easily convert a formatted XML into a single line…
1So you’ve got a nicely formatted XML object, with all your indentation setup so that it is easy to read. However there may come a time when you need that lovely XML to be formatted to a single line.
You could post it into notepad and manually format it, however this becomes quite a chore when your XML object grows. There is a much simpler method!
All you need to do is to copy your XML, and paste it into the Google search bar in the top right hand corner of your Firefox browser (this may also work in other browsers). Then re-copy it and paste it into notepad, voila, it should be all on one line.
Android or Standard Java; Mapping your XML onto POJOs easily, and vice versa
0I’ve listed this post under Android, but to be honest this could apply to both J2SE and J2EE, its not really specific to Android but it was part of a requirement I was working with for a recent Android project.
The problem I had, was that I was getting an XML String as a response from a web service call. The String contained one long String representation of an XML object and I needed to get some data out of that. I could have manipulated the String manually and substring’d out what I required, but that would be incredibly poor and I would likely face verbal punishment from my peers.

