Posts tagged xml
This is something that has had me tearing my hair out for a few days now, I was pretty much border-line braveheart-ing my screen….
I’ve recently been on a little drive to try to maven-ize my projects. All had been going well until I needed to sign and zipalign my APKs. This post will help you conquer that barrier with the use of some maven plugins.
When using ant, I was able to simply enter keystore details into build.properties and just call “ant release”. Unfortunately that approach doesn’t carry across to maven, and you have to provide some more configuration.
So 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.
I’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.