sukhoi35
asked on
How do I 'minify' or clean the XML using Java?
There is a need for me to clean all incoming XML payload data and store it as an unformatted string using Java. In short, do something like what what the link below does. Is there a way this can be achieved using any of the Java libraries?
https://www.webtoolkitonline.com/xml-minifier.html
Thanks.
https://www.webtoolkitonline.com/xml-minifier.html
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you experts, yes the messages received are well formed messages.
:)
If so the approach would be to parse it as an XML document and then walk that document printing out each element in the format you want (which is a single line with all whitespace removed between tags I believe). But that won't work for invalid XML as the parse step would fail.